Fine Grain Data Migration to or from Borrowed Memory

ABSTRACT

Systems, methods and apparatuses of fine grain data migration in using Memory as a Service (MaaS) are described. For example, a memory status map can be used to identify the cache availability of sub-regions (e.g., cache lines) of a borrowed memory region (e.g., a borrowed remote memory page). Before accessing a virtual memory address in a sub-region, the memory status map is checked. If the sub-region has cache availability in the local memory, the memory management unit uses a physical memory address converted from the virtual memory address to make memory access. Otherwise, the sub-region is cached from the borrowed memory region to the local memory, before the physical memory address is used.

RELATED APPLICATIONS

The present application is a continuation application of U.S. patent application Ser. No. 16/424,427 filed May 28, 2019, the entire disclosures of which application are hereby incorporated herein by reference.

TECHNICAL FIELD

At least some embodiments disclosed herein relate to memory services provided by operating systems.

BACKGROUND

In some computer systems, an operating system allows an application program to use virtual addresses of memory to store data in, or retrieve data from, memory components of one or more memory sub-systems of the computer system. The operating system defines the mapping between the virtual memory addresses and the physical memory addresses of one or more memory sub-systems connected to the Central Processing Unit (CPU) and/or a Graphics Processing Unit (GPU) and/or System-On-a-Chip (SoC) of the computer system. Such mapping can be defined through the use of page tables. A page table entry specifies the mapping between a set of virtual memory addresses of a virtual memory page and a corresponding set of physical memory addresses of a physical memory page. The page tables can be used to implement the memory accesses requested for virtual memory addresses by translation of the virtual memory addresses into corresponding physical memory addresses of the memory sub-systems.

A computer processor can have a memory management unit (MMU) configured to perform the translation of virtual memory addresses into physical memory addresses according to page tables defined by the operating system. The memory management unit (MMU) can have a translation lookaside buffer (TLB) that is configured to cache the recently used page table entries. The memory management unit (MMU) may perform other memory related tasks, such as cache control and/or memory protection.

In general, a virtual address space for memory in a computer can be divided into pages of a predetermined size. A page of virtual memory is represented by the collection of the virtual memory addresses; the virtual memory addresses can be mapped to the physical memory addresses of a page of physical memory in the memory sub-systems; page table entries define the address mapping between the page of virtual memory and the page of physical memory.

In some computer systems, an operating system can use a paging technique to access a page of data in a storage or memory device via a page of memory in a memory module. At different time instances, the same page of memory in a memory module can be used as proxy to access different pages of memory in the storage or memory device or another storage or memory device in the computer system.

Remote direct memory access (RDMA) is a technique that allows direct memory access from one computer into another, without involving any of the operating systems of the computers involved (e.g., after the operating systems are executed to negotiate and set up the memory resources for RDMA operations). Prior to an RDMA operation (e.g., read or write), commands are executed to establish a memory mapping between the two computers via one or more networking devices. When an application running on a computer performs an RDMA operation, the application data is delivered directly across the computer network, reducing latency and enabling fast data transfer. RDMA uses a network adapter to transfer data to or from application memory, eliminating the need to copy data between application memory and the data buffers in the operating system.

BRIEF DESCRIPTION OF THE DRAWINGS

The embodiments are illustrated by way of example and not limitation in the figures of the accompanying drawings in which like references indicate similar elements.

FIG. 1 shows a system in which a computing device or a server computer can borrow memory from and/or lend memory to another computing device and/or another server computer.

FIG. 2 illustrates a borrower device and a lender device implementing inter operating system memory services over communication network connections according to one embodiment.

FIG. 3 illustrates a technique to use borrowed memory according to one embodiment.

FIG. 4 illustrates the use of a physical memory region to facilitate access to different borrowed memory regions according to one embodiment.

FIG. 5 illustrates another use of a physical memory region to facilitate access to different borrowed memory regions according to one embodiment.

FIG. 6 illustrates a borrower-lender memory hierarchy in a computing system.

FIG. 7 shows a method to implement inter operating system memory services over communication network connections.

FIG. 8 shows a method to service a page of borrowed memory according to one embodiment.

FIG. 9 shows a borrower device having memory regions of different criticality levels based on which network traffics for memory as a service can be throttled.

FIG. 10 illustrates tagging criticality levels of memory regions in a memory map according to one embodiment.

FIG. 11 illustrates a method to identify the criticality level of a memory region according to one embodiment.

FIG. 12 shows a method to throttle network communications for memory as a service according to one embodiment.

FIGS. 13-15 illustrate hardware accelerated configurations to access borrowed memory according to some embodiments.

FIGS. 16 and 17 illustrate hardware accelerated configurations to provide access to loaned memory according to some embodiments.

FIG. 18 shows a method to accelerate access to borrowed memory via a memory management unit according to one embodiment.

FIGS. 19 and 20 illustrate a borrower device and a lender device configured to perform intelligent content migration according to some embodiments.

FIGS. 21-24 illustrate content movements according to some embodiments.

FIG. 25 shows a method to migrate content in a computing system having borrowed memory according to some embodiments.

FIGS. 26 and 27 illustrate distributed computing based on selectively hosting a virtual address region on local memory of different computers.

FIGS. 28 and 29 illustrate selectively running an application on different computers at different stages of the execution of the application.

FIGS. 30 and 31 illustrate running an application in virtual machines hosted on different computers.

FIG. 32 shows a method of distributed computing based on Memory as a Service (MaaS).

FIG. 33 shows a memory status map configured to identify the cache status of contents of sub-regions.

FIG. 34 illustrates the use of a memory status map to access borrowed memory that can be migrated at sub-region levels.

FIG. 35 shows a borrower device and a lender device configured for fine grain data migration for borrowed memory.

FIG. 36 shows a method of fine grain data migration for borrowed memory.

DETAILED DESCRIPTION

At least some embodiments disclosed herein provide techniques of inter operating system memory services over communication network connections, such that a borrower device can expand its memory capacity by using a communication link and the memory of a lender device. Operating systems of the borrower device and/or the lender device can be configured to seamlessly bridge the gap over the communication link, such that application programs running on the borrower device can use its local memory and the borrowed memory without distinction. The local memory is physically installed in the borrower device; and the borrowed memory is physically installed in a lender device that is connected to the borrower device via a communication connection.

Optionally, a portion of the borrowed memory and/or the local memory in the borrower device can be loaned to another device over a computer network. A borrower device can have multiple lender devices. Thus, a borrower-lender device hierarchy can be formed on a hierarchy of communication links among the devices.

The operating system of the borrower device can use a virtual to physical memory map to bridge the differences in the local memory and the borrowed memory. For example, the operating system of the borrower device can manipulate Page Table Entry (PTE), in response to a miss in the Translation Lookaside Buffer (TLB) of the borrower device that can lead to a determination of a page fault, to use a portion of the local memory of the borrower device as aperture, proxy, and/or cache in accessing the borrowed memory over a communication link. Cache coherency between the lender device and borrower device can be relaxed for improved bandwidth usage. Since the differences between the local memory and the borrowed memory area are shielded by the operating system of the borrower device from applications running on the borrower device, an application running on the borrower device can byte-access the borrowed memory in a same way as accessing the local random access memory configured in the borrower device.

The memory services of the operating systems can be used to construct a multi-level byte-addressable memory in a computer system under a unified address space shared by multiple operating systems over non-coherent communication links. For example, a wearable computing device can borrow memory from a mobile computing device over a personal area network or a local area network. The wearable computing device can be a smart watch, a motion tracking device, or a smart glass, and the mobile computing device can be a smart phone, a touch pad computer, or a notebook computer, etc. The wearable computing device and/or the mobile computing device can borrow memory from a computing appliance over a local area network. For example, the computing appliance can be a mini-server, a desktop computer, a memory appliance, or a storage appliance, etc. The mobile computing device and/or the computing appliance can borrow memory from a server computer or a server farm over the Internet and/or via cloud computing.

In a multi-level hierarchy of lender-borrower of memory resources, each subsequent higher level device (e.g., a mobile computing device, a computing appliance, a server computer or farm) can use their memory capacity to boost on demand the memory capacity of lower level devices (e.g., a wearable computing device, a mobile computing device, a computing appliance), and/or devices in the same level. IoT devices will constitute environment, such as construction materials (concreate walls, roads and so on). It could be that low dense, but highly bulky cheap memory technologies will allow to integrate low-density memory (and compute) in construction at very low cost. Thus, we'll have sort of ‘memory matter’ (or may be compute matter) as a part of the environment that any device can use.

Optionally, some levels in the hierarchy can be skipped, depending on the availability of certain devices and/or network connections. For example, a wearable computing device can borrow memory from a computing appliance without going through a mobile computing device; and a mobile computing device can borrow memory from a server computer or a server farm over the Internet without going through a computing appliance in a local area network.

At the appliance and cloud levels, memory resources can be provisioned as a utility with Memory as a Service (MaaS). Such an arrangement can provide low level computing devices, such as wearable computing devices, mobile computing devices, and/or computing devices of internet of things, with enormous persistent memory capacity and storage resource on demand. Applications running on the low level computing devices can use the memory services provided by the operating systems to use the borrowed memory in a transparent way, as if the borrowed memory were part of the local memory of the borrower devices. As a result, no special programming is required in the applications to use the borrowed memory.

The applications running on the borrower devices can use the borrowed memory to store data persistently and thus eliminate or reduce the need for operations to store data via a file system. For example, a lender appliance/server can provide a persistent random access memory, or a storage capacity, to offer memory resources to borrower devices and manage the persistence and/or redundancy of the data stored in the offered memory resources such that the borrowed memory can be treated as virtual non-volatile random access memory in the borrower devices.

Optionally, memory provided as a service can include semantics for memory page sharing among clients/borrowers, locking mechanisms, time out mechanisms, etc.

As an example, a phone can obtain, as a borrower device, 8 terabyte (TB) of observable memory over a wireless local area network (WLAN) (e.g., facilitated via a home Wi-Fi access point) from a memory appliance functioning as a lender device. The 8 TB of memory is observable to applications running under the operating system of the phone, in a way same as applications running on a phone having 8 TB of local memory. Alternatively, the phone can obtain 8 TB of observable memory over a cellular communications network from a server or the cloud computing infrastructure that is configured as a lender device. Optionally, the phone can borrow part of the 8 TB of observable memory from the memory appliance and part of the 8 TB of observable memory from the server or the cloud computing infrastructure. The 8 TB of observable memory can be virtually made available on the phone by the operating system of the phone such that applications running on the phone can use the virtual/remote memory, even though the phone may have only 8 megabyte (MB) of physical local memory. The 8 TB of borrowed memory expends the memory capability of the phone to over 8 TB; and to applications running on the phone with borrowed memory, the memory capacity of the phone appears to be the same as a phone having more than 8 TB of local random access memory.

Since the borrower devices typically do not use borrowed memory at once at the time of borrowing the memory, the lender devices do not have to block-allocate the memory loaned to the borrowed device upon the borrowing of the memory. The lender devices can implement thin provision of memory (e.g., thinly provision memory) and incrementally allocate the memory in response to the borrower device using an increasing amount of the borrowed memory.

The applications running under the operating system of a borrower device can read and write on demand memory pages that are borrowed from the lender device(s). Physical page allocation in a lender device and/or a corresponding allocation in a borrower device can be configured to be performed in response to a write operation on the page. A part of local memory of the borrower device can be configured as cache, proxy, and/or aperture in accessing a borrowed page. When an application running on the borrower device accesses a virtual page, the operating system of the borrower device can migrate the content of the accessed virtual page to the local memory. When a local memory page has not been accessed for a certain period of time and/or is to be used for hosting the content of another page, the operating system of the borrower device can evict or migrate the content of the virtual page in the local memory to the borrowed memory on the lender device. Optionally, the operating system of the borrower device can use a portion of the local random access memory of the borrower device as a fast buffer for critical data, and use the borrowed memory physically residing in the remote lender device to hold less critical data. Less critical data and/or less frequently used data can be migrated to the local random access memory of the borrower device when needed.

In general, a lender device for a lower level device in the hierarchy can be itself a borrower device in a higher level in the borrower-lender device hierarchy. For example, a phone, as a borrower device, may borrow 8 TB of memory from a memory appliance as a lender device. The memory appliance, as a borrower device, may borrow 4 TB of memory from a server and combine the 4 TB of memory borrowed from the server and 4 TB of its local memory into the 8 TB of memory loaned to the phone. In some implementations, the 4 TB of memory borrowed from the server can be identified to the phone such that when the connection between the phone and the appliance is not available, the phone can use an alternative connection to the server to continue using the 4 TB memory without going through the memory appliance. However, the alternative connection may be slower than the one to the memory appliance, since the appliance could be in closer proximity to the phone than the remote server.

The operating system of a lender device and the operating system of a borrower device can communicate with each other to facilitate seamless memory access across the communication link between the lender device and the borrower device. Thus, it is not necessary to pre-allocate physical memory in the lender device before applications running on the borrower device start using memory. The page eviction traffic and lender device memory availability determine the size of the usage of borrowed memory as the footprint of the applications running on the borrower device grows. Elimination of the requirements for pre-allocation of the physical memory in the lender device for an application (e.g., as required in case of RDMA protocols) removes a necessity for special programming (e.g., Message Passing Interface (MPI) over RDMA) and allows an application program to function in devices of varying configurations in their original code yet utilizing all benefits of scale-out application capacity as they would in the case of RDMA and alike.

In general, a lender device can be configured to operate in a passive mode or an active mode for a particular borrower device. The lender device can operate in different modes for different borrower devices.

In the passive mode, the operating system of the lender device observes memory pages that are cached or migrated by the operating system of the borrower device over the link and modifies its own page table entries, which correspond to these pages, accordingly. Observation that the lender operating system performs on page movement can be done for example by the bus snooping or hardware monitoring.

The operating system of a borrower device is configured to maintain page tables for local memory of the borrower device and the borrowed memory that physically resides in the lender device. In general, when a page of borrowed memory is being accessed by an application running on the borrower device, the content of the page may or may not be currently stored in a page of local memory of the borrower device.

When the borrower device accesses a page that does not exist in the local memory of the borrower deice a page fault happens. For our purpose we consider a page fault happening in two cases: 1) an accessed page does not exist at all; and 2) the accessed page exists but not in local memory.

If the page does not exist, it was never written or read. There is no page table entry (PTE) for that page. It is first time the page is being accessed. If a read operation is performed on such a page, it is not necessary to allocate actual page. Some operating systems (e.g., Linux) can provide a fake page filled with zeros, because the page has never written and thus contains no data. Hence, a read operation performed on such a page gets zero as a result. In this case the OS executes handler for this page fault: TLB miss causes page walk, which determines that a read operation is performed on a page without PTE. As a result, a mapping to zero page is returned.

If a write operation is performed on a page for the first time, it is a true fault. The true fault results in a new PTE and page allocation in local memory. An example of page fault handler for this case: the TLB miss causes page walk, which determines that a write operation is performed on a page without PTE. As a result, the operating system allocates new page, generates the PTE and installs the PTE in the page table. After the PTE is cached in TLB, the fault is resolved.

When a page fault occurs in accessing the borrowed page and the content of the page is not currently in the local memory of the borrower device (e.g., after the content of the borrowed page has been migrated/evicted to the lender device), the operating system of the borrower device can communicate with the lender device over the communication link between the borrower device and the lender device to retrieve or migrate the content of the borrowed page.

Caching operations can be performed in connection with the processing in the above discussed two cases. For example, the lender device can keep a page copy. The copy can be useful if the borrower device does not further modify the page (e.g., performs only read operations on the page). In such a situation, no eviction is needed because true copy of the page already exists on the lender device. Similarly, the borrower device can perform speculative eviction of a page, when the communication link between the borrower device and the lender device is free to use.

Optionally, the lender device and/or the borrower device can be configured with firmware/hardware that accelerates the operations of migrating the content between the lender device and the borrower device.

Optionally, the operating system of the lender device can be configured to maintain and operate its own set of page tables and associated resources, such as page table walker, Translation Lookaside Buffer (TLB), Content-addressable memory (CAM), lookup tables etc.

The operating system of the lender device monitors memory access requests from any of the borrower devices that borrow memory from the lender device. It can be configured to provide semantics for page sharing among the borrower devices (e.g. atomics, locks, semaphores, flags, timeouts, etc.). As a result, the address space of borrowed memory is unified among the borrower devices according to the page tables in the lender device. Distributed applications can take advantage of the unified address space by sharing borrowed memory, via the lender device, with different instances applications running on different borrower devices.

Optionally, the lender device can be configured to accept requests from borrower devices to produce computation results on certain regions of memory loaned to the borrower devices. Thus, the lender device provides not only the memory resource but also the computing power for processing data in the memory loaned to the borrower devices.

The memory services offered by the operating systems of borrower devices and lender devices allow an application running on a borrower device to address borrowed memory at byte granularity with fault resolved at page granularity.

The operating system of the borrower device can evict or migrate a page from local memory to the lender device over the communication link between the borrower device and the lender device. The operating system of the borrower device can identify a page for eviction or migration from the local random access memory of the borrower device to its borrowed memory based on the infrequent use of the page and/or based on the page being used less recently than other pages or based on criticality or any other possible measurable system parameter. The operating system of the borrower device can decide to evict or migrate a borrowed page to free local memory for other uses, such as new local page allocations or for migration of a page from the lender device. As a result of this method the current page owner (borrower or lender) owns true copy of the page. Other devices may still cache it just in case if page is still not modified after the owner releases it. For example, when borrower gets the page from the lender the lender does not have that page any more. However, the lender may not delete page copy but keep it: in case if page will be non-modified upon eviction there will be no need to transfer it over the link back to the lender. What if lender also wants to modify it or provide it to other borrowers? In this case all writes would have to happen on the lender so to merge these write request from different borrowers.

To evict or migrate a page, the operating system of the borrower device communicates the content of the page to the lender device, causing the lender device to store the page in the memory of the lender device. The operating system of the borrower device can then update a page table to indicate that the page is now in the lender device and not in the local memory of the borrower device.

In active mode, the operating system of the lender device can be configured to monitor page tables on the borrower device, identify unused pages, and repurpose the unused pages for other memory users.

The interactions between the lender device and the borrower device can be implemented via virtualization, which allows the lender device to monitor page table usages in the borrower device.

For example, the operating system of the borrower device can be partially virtualized for operations in the operating system of the lender device. Some of the memory management code/subroutines of the operating system of the borrower device can be configured via virtualization to run on the lender device and/or as part of the operating system of the lender device. In such an implementation, the operating system of the borrower device can extend memory access request to the operating system of the lender device to execute such subroutines, which may be hardware/firmware-accelerated at the level of the operating system of the lender device.

For example, the operating system of the lender device can create a virtual memory device and offer the virtual memory device to the borrower device. The borrower device can request the virtual memory device on demand and make available the virtual memory device for servicing the memory resource needs of applications running on the borrower device.

In some instances, if an application running on the borrower device can tolerate or accept the latency caused by the communication link between the borrower device and the lender device, access to the borrowed page can be made directly over the communication link without migrating the entire page to the lender. In other implementations, the content migration can be configured at a sub-page level; and only the portion of the page that is being accessed and/or predicted to be accessed is migrated. Optionally, the operating system may use a remote direct memory access (RDMA) technique in implementing the direct memory access. Optionally, such direct memory access can be implemented at the memory controller and/or memory management unit and thus avoid the standard RDMA protocol and its overhead.

In some implementations, the operating system of the borrower device is configured to dynamically adjust physical location of virtual memory pages. A page of virtual memory is specified by the virtual memory addresses of the page. The virtual memory page can be initially located in the local memory of the borrower device, subsequently moved to the memory loaned by a lender device to the borrower device, and subsequently moved to another local page of the borrower device.

To migrate a virtual page from the lender device to the borrower device, the borrower device fetches the content of the page from the lender device, stores the content in its local memory, and updates relevant page tables to establish the mapping between the local physical page and the virtual page. Once the virtual page is migrated to the borrower device, the lender device can free the physical memory that was previously used for the virtual page and/or erase the data stored there. Optionally, the operating system of the lender device can reserve the page previously used for the virtual page and keep its content as a backup copy of the virtual page.

In the reverse direction, the operating system of the borrower device can migrate the virtual page from the borrower device to the lender device. For example, the operating system of the borrower device can request the allocation of a borrowed page in the lender device, and transmit the content of the virtual page for storing it in the borrowed memory on the lender device. Once the content of the virtual page is stored on the lender device, the operating system of the borrower device can update its page tables for the virtual page to identify the mapping between the virtual page and its physical location in the borrowed memory to complete the migration of the page to the lender device. After the migration of the virtual page, the local memory previously used to host the virtual page can be used for hosting another virtual page. In such an implementation, it is not necessary to statically map a predetermined portion of the virtual memory or virtual memory address space to the borrowed memory in the lender device(s).

Furthermore, a virtual page does not have to be hosted in a predetermined lender device. For example, the operating system of the borrower device can migrate a virtual page from a first lender device to the borrower device, and then migrate the virtual page from the borrower device to a second lender device. In some instances, the operating system of the borrower device can request the migration of a virtual page from a first lender device to a second lender device without downloading the content of the page to the borrower device and then uploading this content to the second lender device.

Using the techniques of Memory as a Service (MaaS), mobile device vendors can market mobile devices having terabytes of memory capacities at the operating system level, which is to be backed by emerging memories on the lender devices including cloud computing infrastructure. For example, applications in a smart phone configured with 128 MB local memory can access 64 TB of random access memory when the phone is connected to a computer network or the internet or local memory appliance or any other device that implements concepts of MaaS described herein.

FIG. 1 shows a system in which a computing device or a server computer can borrow memory from and/or lend memory to another computing device and/or another server computer.

FIG. 1 illustrates computing devices (101 and 103) and server computers (105 and 107) as examples of borrower devices and lender devices connected via computer networks and/or the Internet (109), which can include a cellular communications network, such as a fifth generation cellular network.

Each of the computing devices (101 and 103) and server computers (105 and 107) can borrow memory from another device and/or lend memory to another device. Each of the computing devices (101 and 103) and server computers (105 and 107) can have one or more communicating devices (e.g., 117, 137, 157, and 177) to establish one or more communication links with each other or another computing devices or server computers in the system. Each of the computing devices (101 and 103) and server computers (105 and 107) can have one or more processor(s) (e.g., 115, 135, 155, and 175) configured to execute instructions, such as instructions of operating systems (e.g., 113, 133, 153, and 173) and applications or programs running under the operating systems.

Each of the computing devices (101 and 103) and server computers (105 and 107) can have local random access memory (e.g., 111, 131, 151, and 171) coupled (e.g., via memory buses) to respective processors (e.g., 115, 135, 155, and 175).

In some examples, the device A (101) or device B (103) can be a wearable computing device, a computing device of Internet of Things, a mobile computing device, etc.

In some examples, the server P (105) or server Q (107) can be a mini-server, a personal computer, a memory appliance, a storage appliance, a network storage device, a server computer, a server farm, etc.

In one example, the device A (101) can be connected to the device B (103), the server P (105), and/or the server Q (107) using a wired connection, a wireless personal area network (WPAN), a wireless local area network (WLAN), and/or a wireless wide area network (WWAN).

In another example, the device B (103) can be connected to the server P (105), and/or the server Q (107) using a wired connection, a wireless local area network (WLAN), and/or a wireless wide area network (WWAN).

In another example, the server P (105) can be connected to the server Q (107) using a wired connection, a local area network, a wireless local area network (WLAN), a wireless wide area network (WWAN), and/or the Internet.

The server P (105) can borrow memory from the server Q (107) and lend borrowed memory and/or local memory to the devices (101 and 103) (and/or similar devices). The device B (103) can borrow memory from the server P (105) and/or server Q (107) and lend borrowed memory and/or local memory to the device A (101) (and/or similar devices).

In general, a computing device can loan memory to one or more borrower devices and borrow memory from one or more lender devices.

The operating systems (113, 133, 157, and 173) are configured to provide memory services to applications and programs such that the applications and programs can use virtual memory without awareness of its physical allocation, such that this virtual memory may be partially allocated in borrowed memory and partially allocated in local memory (111, 131, 151, and 171). The operating systems and supporting hardware takes the burden from applications and programs to manage virtual memory allocations, which provides convenience for applications and programs not to have special code sections or designated instructions designed to handle the differences in local memory and borrowed memory allocations.

In one example, a portion of the local memory (171) of the server Q (107) is loaned to the server P (105). The server P (105) loans a portion of the borrowed memory and/or a portion of its local memory (151) to the device B (103), which in turn loans a portion of its borrowed memory and/or a portion of its local memory (131) to the device A (101). Thus, the virtual memory allocated by the operating system (113) to an application running on the processors (115) of device A (101) may partially reside in the local memory (111) of the device A (101), partially in the local memory (131) of the device B (103), partially in the local memory (151) of the server P (105), and/or partially in the local memory (171) of the server Q (107). The operating systems (113, 133, 157, and 173) are configured to cooperate with each other to provide the memory services and/or the physical allocation of the virtual memory used by the application among the local memories of various devices (e.g., 111, 131, 151, and/or 171) such that the application programmed to run on the device A and its local memory (101) can also run without modification with its virtual memory partly allocated in the borrowed memory (131, 151 and/or 171) loaned to the device A (101) by the device B (103), the server P (105) and/or the server Q (107).

FIG. 2 illustrates a borrower device (201) and a lender device (203) implementing inter operating system memory services over communication network connections, such as a wired or wireless connection (205) over a local area network, a wide area network, and/or a cellular communications network such as a fifth generation cellular network.

In FIG. 2, the borrower device (201) borrows memory from the lender device (203); and the lender device (203) loans the memory (202) to the borrower device (201). For example, the borrower device (201) can be the device A (101), the device B (103), or the server P (105) in the system of FIG. 1; and the lender device (203) can be the device B (103), or the server P (105) in the system of FIG. 1. Further, lender device functionalities can be implemented in the borrower device (201), enabling it to loan memory to another device. Similarly, borrower device functionalities can be implemented in the lender device (203), enabling it to borrow memory from another device.

In FIG. 2, the borrower device (201) has a communication device (217), one or more processors (215) with a memory management unit (MMU) (216), and local random access memory (211). The processor(s) (215) and the local memory (211) can be in separate computer chips and/or formed on separate integrated circuit dies in some embodiments, and can be packaged in a same computer chip and/or formed on a same integrated circuit die in other embodiments (e.g., in a System-On-a-Chip (SoC)).

The operating system (213) of the borrower device (201) includes a memory service module (209) configured to maintain a memory map (207). The memory map (207) identifies the mapping between virtual memory and physical memory, where the physical memory can be partially in the local memory (211) in the borrower device (201) and partially in the loaned memory (202) in the lender device (203). The operating system (213) services virtual memory to one or more applications (e.g., 212) running on the borrower device (201). The processor(s) (215) can run the application (212) by executing the instructions of the application code (212). The application memory read and write instructions can use the virtual memory. The memory management unit (MMU) (216) translates the virtual memory addresses into physical memory addresses according to the memory map (207).

When the borrower device (201) borrows memory from the lender device (203), the borrowed memory (204) is virtually in the borrower device (201) and physically it is in the lender device (203) as the loaned memory (202) in the local random access memory (231). Optionally, the lender device (203) can configure a portion of the loaned memory (202), or its entirety, in a storage device (232) that is coupled to the processor(s) (235) of the lender device (203) via a peripheral bus and/or a device controller. For example, the operating system (233) of the lender device (203) can allocate a portion of its memory resources as virtual memory to the operating system (213) of the borrower device (201) in a way similar to allocating memory resources as virtual memory to an application (e.g., 234) running on the lender device (203). Thus, the borrowed memory (204) used by the operating system (213) of the borrower device (201) can be in the unified virtual memory address space as the virtual memory used by the application (234) and/or borrowed memory used by other borrowers of the lender device (203). Alternatively, the operating system (233) of the lender device (203) can create virtual memory components for the borrowed memory (204); and operating system (213) of the borrower device (201) can make accessible the virtual memory component in the borrower device (201). A virtual memory controller for the virtual memory component can be implemented in the operating system (213) to access virtual memory components accessible to the borrower device (201). MMU 216 can implement hardware blocks to accelerate virtual memory controllers, and by doing so, improve speed of virtual memory component access.

In some examples the borrowed memory (204) is implicit, such that it is indistinguishable from the rest of virtual memory of applications running on borrower device 201. The distinction comes only when translating virtual page addresses to physical addresses by reading memory map 207, and upon that translation the physical addresses appear to be in the loaned memory 202. In other examples, the operating system (213) stores explicit identification for parts of virtual memory if it belongs to the borrowed memory (204) as provided by the lender device (203). In all cases the operating system 213 configures the memory map (207) to access the lender device (203) to read from and write to the virtual memory as being the borrowed memory (204) that is physically in the loaned memory (202) in the lender device (203) or in the borrower device (201) after migration to that device.

The memory map (207) can be implemented via page tables. A portion of the page tables are cached in the memory management unit (MMU) (216) such that when instructions executed in the processor(s) (215) access virtual addresses defined in the portion of page tables cached in the memory management unit (MMU) (216), the memory management unit (MMU) (216) translates the virtual addresses into physical addresses. The successful address translation allows the processor(s) (215) to proceed with memory accesses without the need to execute the code of operating system (213).

When the memory management unit (MMU) (216) cannot successfully translate a virtual memory address using the page tables cached in the memory management unit (MMU) (216), a page table entry cache miss is generated, which causes the processor (215) to execute the instructions of the memory service (209) of the operating system (213) to resolve this cache miss. In some implementations MMU contains a hardware IP architected to resolve page table entry cache miss in the cache of MMU (216). This IP, being a part of MMU, extracts required page table entries from page tables stored in the physical memory 211. If a required entry does not exist or it exists but it translates virtual page address to address in physical loaned memory 202 then a page fault is generated for this page. This fault can be resolved by the MMU 216 and communication deice 217 directly in hardware. Alternatively, this fault can be resolved by the operating system 213 and memory service 209 in software assisted by hardware blocks: MMU 216, processors 215, communication deice 217.

When the memory service (209) of the operating system (213) or MMU 216 determines that the virtual memory address being accessed is in the borrowed memory (204), the memory service (209) or MMU 216 can allocate a physical page of the local physical memory 211, communicate with the lender device (203) via communication devices 217 and 237 and computer network connection 205 to migrate the page of the borrowed memory (204) from the physical loaned memory 202 into the physical local memory 211, generate a page table entry mapping the virtual page to the allocated local physical page, and load the page table entry into the memory management unit (MMU) (216). Thus, before the page fault, the virtual page of the borrowed memory (204) is physically located in the loaned memory (202) in the lender device (203). After the processing of the page fault, the virtual page is located in the local memory (211). The content of the page in loaned memory 202 of the lender device 203 may still be saved for future use and other purposes.

When there is no free local page available for the migration, the memory service (209) can evict a selected virtual page that is currently in the local memory (211) to the loaned memory (202). When evicting the selected virtual page to the lender device (203), the memory service (209) communicates with the lender device (203) to transmit the content of the virtual page from the local memory (211) to the loaned memory (202) and updates the memory map (207). After evicting the virtual page from the local memory (211), the space in local memory (211) that was used for the evicted virtual page can be freed.

For example, the memory service (209) can be configured to evict the least frequently used virtual page or the least recently used virtual page.

In FIG. 2, the lender device (203) has a communication device (237), one or more processors (235) with a memory management unit (MMU) (236), and local random access memory (231). Optionally, the lender device (203) includes one or more storage devices (232) that are connected to the processor(s) (235) via a peripheral bus and/or a computer network. For example, the storage device (232) can be a solid state drive (SSD) or a hard drive (HD).

The operating system (233) of the lender device (203) includes a memory service module (229) configured to maintain a memory map (227). The memory map (227) identifies the mapping between virtual memory and physical memory. The memory map can be stored in the memory 231 or dedicated for its memory such as content-addressable memory or special cache. The operating system (233) services virtual memory to one or more applications (234) running on the lender device (203) in a way similar to the borrower device (201) servicing its application (212).

Optionally, the lender device (203) provisions loaned memory (202) to the borrower device (201) in a unified virtual memory space. The memory service (209) of the borrower device (201) uses the borrowed memory (204) in the same way as the application (234) using virtual memory provisioned by the memory service (229). For example, the memory service (229) of the lender device (203) can allocate virtual memory to the application (234) running on the lender device (203) and allocate virtual memory as the borrowed memory (204) used by the memory service (209) of the borrower device (201), as if the memory service (209) were an application running on the lender device. Thus, the application (234) running on the lender device (203) and the borrower device (201) (and other devices that borrow memory from the lender device (203)) can operate in a unified virtual address space. Cooperative computations can be configured based on the unified virtual address space. Further, when the lender device (203) borrows memory from another device/server (e.g., 105 or 107), the borrowed memory can also be provisioned in the unified virtual address space. The unified address space can facilitate data sharing and collaborative computation among the computing devices.

The memory service (229) of the lender device (203) can maintain a memory map (227), including the mapping between the virtual addresses of the loaned memory (202), which corresponds to the borrowed memory (204) accessed by the borrowed device (201), and the physical addresses of the loaned memory (202). For example, a page table entry of the virtual page identified by the borrower device (201) in accessing a borrowed page can be loaded into the memory management unit (MMU) (236) to facilitate the translation between the addresses of the virtual page and the physical address of the loaned memory (202) for the processor(s) of the lender device (203) to perform computations on behalf of the borrower device (201). Optionally, the lender device (203) can include a hardware similar to the memory management unit (236) to facilitate optimized and/or accelerated data transfer between the lender device (203) and the borrower device (201) using the memory map (227) that identifies the mapping between the borrowed memory (204) as known to the borrower device (201) and the loaned memory (202) physically accessible in the lender device (203).

FIG. 3 illustrates a technique to implement borrowed memory according to one embodiment. For example, the technique of FIG. 3 can be implemented in the borrower device (201) illustrated in FIG. 2.

FIG. 3 illustrates memory (211), a memory management unit (MMU) (216) configured to access the memory (211) using physical addresses (e.g., 257), and a memory map (207) that defines mapping between virtual address regions (e.g., 261, 263, 265, . . . ) and address regions where the virtual memory regions are mapped to, such as physical address regions (e.g., 281, 283, . . . ) and borrowed memory regions (e.g., 273, 275, . . . ).

For example, the borrowed memory address regions (e.g., 273, . . . , 275) can be configured to identify the virtual address regions allocated by the lender device (203) as the memory provisioned/loaned to the borrowed device (201).

For example, a virtual address region A (261) is associated with a physical address region (281) in the memory map (207) to indicate that the region of virtual memory is currently directly mapped to the corresponding region of local physical memory (211).

For example, a virtual address region B (263) is associated in the memory map (207) with a borrowed memory address region X (273) and a physical address region S (283) to indicate that the virtual address region B (263) is mapped to the borrowed memory address region X (273) and physically resides in the physical address region S (283). Thus, access to the virtual address region B (263) can be fulfilled through accessing the physical address region S (283) in the local memory (211). Virtual address region C (265) is associated in the memory map (207) with a borrowed memory address region Y (275) and is not associated with any physical address region in the memory map (207). Thus, for accessing the virtual address region C (265) the borrower device needs to communicate with the lender device.

The content in the physical address region S (283) can be evicted to the lender device to free the physical address region S (283). Once the physical address region S (283) is freed, it can be used to for physical placement of another borrowed memory address region, such as the borrowed memory address region Y (275). Once the content of the borrowed memory address region Y (275) is migrated from the lender device to the borrower device to the physical address region S (283), the physical address region S (283) can be used to provide access to the virtual address region C (265) mapped to the borrowed memory address region Y (275) of the unified address space and physically located in the physical address region S (283) of the borrower device, as illustrated in FIG. 4.

In FIG. 5, the memory management unit (MMU) (e.g., similar to 216 illustrated in FIG. 3) has a translation lookaside buffer (TLB) (e.g., similar to 251 illustrated in FIG. 3) that can store a virtual to physical memory map (253) (e.g., a portion of the memory map (207) maintained by the operating system (213) of the borrower device (201)). When a processor (215) of the borrower device (201) executes an instruction that uses a virtual address (255), the TLB (251) uses the virtual to physical memory map (253) to translate the virtual address (255) into a physical address (257); and the memory management unit (MMU) (216) can use the physical address (257) to access the memory page (259) in the memory (211) (e.g., through a memory bus).

The virtual to physical memory map (253) loaded in the TLB (251) is typically a portion of the memory map (207) managed by the operating system (213) of the borrower device (201). When the processor (215) of the borrower device (201) executes an instruction that uses a virtual address that is not covered in the virtual to physical memory map (253) in the TLB (251), the memory management unit (MMU) (216) can cause the processor (215) to execute the operating system (213), which is programmed to replace a portion of the virtual to physical memory map (253) in the TLB (251), such that the updated virtual to physical memory map (253) in the TLB (251) includes the data for the translation of the virtual address (e.g., 255) to a physical address (e.g., 257).

The memory management unit (MMU) (216) is typically configured to access the memory (211) via a memory bus coupled between the memory management unit (MMU) (216) of the borrower device (201) and the local memory (211) of the borrower device (201). When the virtual address (255) is initially in a virtual address region (e.g., 265) mapped to a borrowed memory address region (e.g., 275), the operating system (213) can migrate the content of this region from loaned memory of the lender device to a physical address region (e.g., 283) in the memory (211) and update the virtual to physical memory map (253) in the TLB (251) to allow the translation of the virtual address (255) into a physical address (257) corresponding to the virtual address (255) directly without translating it to the borrowed memory address region (e.g., 275).

In some embodiments, the memory management unit (MMU) (216) is further configured to access borrowed memory (204) using the communication device (217) over a computer network connection (e.g., 205) without explicit migration. In such a situation, it is not necessary for the operating system (213) to migrate the content of a virtual address region (e.g., 265). The physical address (257) of the borrowed memory (204) can include information for the communication device (217) to access the memory page (260) in the loaned memory (202) in the lender device (203). The memory access request made using the physical address (257) and via the communication device (217) can be processed in the lender device (203) via its operating system (233). Alternatively, the communication device (237) and/or the memory management unit (MMS) (236) can be configured to process such an access request to the loaned memory (202) (e.g., for read or write) without executing the operating system (233) (e.g., based on a virtual to physical memory map cached in the TLB of the MMS (236) of the lender device (203) or a hardware acceleration component configured in the lender device (203) to perform similar operations).

The virtual to physical memory map (253) can be implemented in the form of page table entries.

FIG. 6 illustrates a borrower-lender memory hierarchy in a computing system.

In FIG. 6, the lender device (203) can borrow memory from one or more lender servers (245) in a way similar to the borrower device (201) borrows memory from the lender device (203) in FIG. 2. The lender device (203) pools at least some of its local physical memory (e.g., 231 illustrated in FIG. 2) and/or some of its memory borrowed from the lender servers (e.g., 245) as available memory (231) for loaning to borrower devices (201). One or more borrower devices (201) can borrow memory from the lender device (203).

A typical borrower memory (204) can have multiple borrowed memory regions (295, 297, . . . , 299) and multiple local memory regions (291, 293, . . . ). The borrowed memory regions (295, 297, . . . , 299) in the borrower device (201) can be accessed via migration from the loaned memory of the lender device to the local memory regions of the borrower device (291, 293, . . . ). When the borrowed memory regions (295, 297, . . . , 299) are not used in the borrower device (201), they can be evicted back to the lender device (203), as illustrated in FIG. 4 and FIG. 5.

Similarly, the lender device (203) may host a region (e.g., 299) loaned to the borrower device (201) in its local memory, or the local memory borrowed from the lender server (245).

In general, more than one lender devices (203) can be used to provide memory services to a borrower device (201); and more than one lender server (245) can be configured in the hierarchy.

Optionally, the memory (e.g., 295, 297, . . . , 299) provided as a service in the hierarchy is configured in a unified virtual address space. Thus, the borrower devices (201), the lender device(s) (203), and the lender server(s) (245) can collaborate in processing data in the memory by referencing the virtual addresses in the unified virtual address space.

For example, the borrower device (201) in FIG. 6 can be the device A (101) or device B (103) in the system of FIG. 1.

For example, the lender device (203) in FIG. 6 can be the device B (103) or server P (105) in the system of FIG. 1.

For example, the lender server (245) in FIG. 6 can be the server P (105) or Q (107) in the system of FIG. 1.

FIG. 7 shows a method to implement inter operating system memory services over communication network connections. For example, the method of FIG. 7 can be implemented in the system of FIG. 1, with a borrower-lender configuration illustrated in FIG. 2, and/or a borrower-lender memory hierarchy illustrated in FIG. 6.

At block 301, a communication connection (205) is established from a borrower device (201) to a lender device (203).

At block 303, the borrower device (201) communicates with the lender device (203) to borrow an amount of memory from the lender device (203). The lender device (203) can allocate loaned memory (203) that is borrowed by the borrower device (201) as the borrowed memory (204) usable by the borrowed memory (204) as virtual memory. By borrowing/loaning memory, the devices (201 and 203) establish a configuration where the processor(s) of the borrower device (201) can read and/or write into the borrowed memory (204)/loaned memory (202). In some instances, the loaned memory (202) is itself a memory borrowed from another lender device (e.g., 245).

At block 305, the operating system (213) of the borrower device (201) extends a virtual/logical address space of the borrower device (201) to cover the borrowed memory (204). The applications (e.g., 212) running on the processor(s) (215) of the borrower device (201) can use the virtual addresses in the space without distinction between borrowed memory (204) and local memory (211).

At block 307, the operating system (213) of the borrower device (201) generates a memory map (207) (e.g., in the form of page tables) that maps the extended portion of the logical address space to the borrowed memory (204).

At block 309, the operating system (213) of the borrower device (201) allocates the extended portion of logical address space to applications (212).

At block 311, the operating system (213) of the borrower device (201) services access to the borrowed memory (212) via access to a portion of physical memory (211) of the borrower device (201).

FIG. 8 shows a method to service a page of borrowed memory according to one embodiment. For example, the method of FIG. 8 can be implemented in the system of FIG. 1, with a borrower-lender configuration illustrated in FIG. 2, and/or a borrower-lender memory hierarchy illustrated in FIG. 6. For example, the method of FIG. 8 can be used to implement the block 311 of the method of FIG. 7.

At block 331, a borrower device (201) reserves a page of physical memory (211) of the borrower device (201) for borrowed memory page (204).

At block 333, a processor of the borrower device (201) accesses a virtual memory address (255) that corresponds to a memory page (260) in the borrowed memory (204). A borrowed memory page (204) can be physically in the loaned memory (202) of a lender device (203).

At block 335, the memory management unit (MMU) (216) of the borrower device (201) determines that there is no page table entry available in a Translation Lookaside Buffer (TLB) (251) to translate the virtual memory address (255) to local physical memory address. Such a determination (e.g., TLB miss) causes the borrower device (201) to run its operating system (213) to search for page table entry in the memory map.

At block 337, the operating system (213) running on the borrower device (201) identifies a page table entry in the memory map that translates the virtual memory address of the page to the borrowed memory address of the page.

At block 339, the operating system (213) running on the borrower device (201) communicates with the lender device and migrates the physical content of the borrowed page with borrowed memory address to the local memory and places that content at available physical address of the local memory. Borrowed page eviction of a different borrowed page from borrower device to lender device may need to be performed when there is not enough local memory for the page migration of the borrowed page from lender device to borrower device.

At block 341, the operating system (213) running on the borrower device (201) generates a page table entry mapping virtual addresses (e.g., 255) of the borrowed page to the physical addresses (257) in the local memory.

At block 343, the operating system (213) running on the borrower device (201) loads the page table entry into the Translation Lookaside Buffer (TLB) (251), which allows the processor to continue accessing the virtual memory address (255) using the translated physical memory address (257).

In some situations, the computer network connection (205) between the borrower device (201) and the lender device (203) have a limited and/or degrading communication bandwidth. The borrower device (201) can throttle the network traffic/bandwidth allocated to different memory regions based on the criticality of the memory regions.

For example, pages of borrowed memory (204) can be tagged with criticality indicators based on the category of the content stored in the memory, the priority ranks of applications using the borrowed memory, and/or the data criticality levels suggested by the applications. When the connectivity bandwidth between the borrower device (201) and the lender device (203) degrades, the least critical pages can be configured to be less accessible, by allocating less communication bandwidth for fetching, retiring, eviction, and/or migration of such pages. Access to the least critical pages can be slowed and/or temporarily cut off, in view of the degradation in the connectivity bandwidth between the borrower device (201) and the lender device (203).

The operation of cessation memory can be prepared via quiescing or suspending an application that attempts a demand load from that memory. The application may not make forward progress during that time. It is possible to perform a graceful degradation when an application is cut off from accessing borrowed memory. An application can be made aware that a load or store operation could result in being suspended; and a vastly different programming paradigm can be used. For example, each memory access can be wrapped in a try-catch exception wrapper. However, such an approach has significant cost. Further, the application can be handled to gracefully handling such exception. For example, the application can hold some context open, and manage that context, relating to the aborted load/store operation, informing the data movement infrastructure whether that load/store still needs to be serviced eventually.

When the borrowed memory pages are throttled according to criticality, applications running on the borrowed memory (204) can still gracefully degrade without catastrophic failure, and proceed with reduced functionality with less reachable/usable content.

For example, a media library can prioritize its content based on usage frequency, usage history, and/or predicted usage. The priority can be used in the determination of the criticality of the borrowed memory pages in which the contents are stored. Thus, access to the less critical contents in the borrowed memory can be restricted and/or cut off with reduced impact on the usability of the media library.

FIG. 9 shows a borrower device (201) having memory regions of different criticality levels (or priority levels) based on which network traffics for memory as a service can be throttled. For example, the borrower device (201) can be implemented in a way illustrated in FIG. 2 and/or can borrow memory in a hierarchy illustrated in FIG. 6, or in a system illustrated in FIG. 1.

In FIG. 9, the memory regions (295, 297, . . . , 299) in the borrowed memory (204) can be labeled with criticality levels (401, 403, . . . , 405) respectively. The criticality levels (401, 403, . . . , 405) rank the relative priorities among the memory regions (295, 297, . . . 299). Network bandwidth used for the communications between the borrower device (201) and its lender device(s) (e.g., 203) can be allocated according to the criticality levels (401, 403, . . . , 405).

For example, when multiple regions (e.g., 295, 297) need to be migrated from the lender device (203) to the borrower device (201), the regions (e.g., 295, 297) can be migrated in an order according to their criticality levels (e.g., 401, 403). In such an arrangement, repeated requests to memory regions of high criticality levels may indefinitely delay the access to memory regions of low criticality.

Alternatively, the bandwidth may be shared among the multiple regions (e.g., 295, 297) of different criticality levels. For example, the amounts of data communications over the network connection (205) allowed for different regions within a given time period can be allocated according to a ratio determined based on the criticality levels of the memory regions. Thus, fetching the content of a memory page of a low criticality level will take a longer time than fetching the content of a memory page of a high criticality level. However, the fetching of the low criticality page is not going to be completely blocked by the fetching of the high criticality page. Further, the ratio can be adjusted based on the overall available bandwidth such that the performance of accessing a high criticality page can degrade less severely than the low criticality page when the overall available bandwidth degrades. Thus, the user experience with the applications running in the borrower device can be optimized via selectively degrading the access speeds of less critical aspects.

In FIG. 9, the contents in the memory regions (e.g., 291, . . . , 293) in the local memory (211) can also be labeled with criticality levels (e.g., 407, . . . , 409). The criticality levels (e.g., 407, . . . , 409) can be used to arrange predictive eviction or migration of less critical contents to the borrowed memory (204) in anticipation of significant degradation in overall available bandwidth.

For example, in a particular model of bandwidth sharing at sub-page granularity, a link level bandwidth management capability or a forced chunking on the link can be used. Such an implementation may be lead to potentially inefficient non-throttle scenarios. Alternatively, when the granularity of management is the page (instead of sub-page), the rate of pages fetched may be slow, not the actual time it takes for a single page to be fetched. With certain implementations, fetching the content of a memory page of a low criticality level can take a longer time than fetching the content of a memory page of high criticality level. In other implementations, the duration of time taken to fetch a low criticality page can substantially stay constant but the rate at which groups of low criticality pages can be fetched can slow relative to groups of high criticality pages.

For example, in some instances, a borrower device (201) borrows memory from several lender devices (e.g., 103, 105, and/or 107). For example, the borrower device (201) can instruct one lender (e.g., 105 or 107) to transfer or copy a memory page loaned to the borrower device (201) to another lender (e.g., 103 or 105) directly. Alternatively, the borrower device (201) can migrate the memory page from one lender (e.g., 105 or 107) to the local memory, and then evict the page to another lender (e.g., 103 or 105).

FIG. 10 illustrates tagging criticality levels (or priority levels) of memory regions in a memory map according to one embodiment. For example, the memory map of FIG. 10 can be used to implement the criticality labeling in FIG. 9.

In FIG. 10, the virtual memory address regions (261, 263, 265, . . . ) can be mapped to physical address regions (281, 283) and borrowed memory address regions (273, 275, . . . ), in a way similar to that in FIG. 3, 4, or 5. For example, the memory map (207) can be specified in the form of page tables.

Further, for each of the virtual address regions (261, 263, 265, . . . ), the memory map (207) can include a criticality level (e.g., 411, 413, or 415). The criticality level (e.g., 411, 413, or 415) can be used to determine the share of bandwidth the virtual address region (e.g., 261, 263, or 265) can use to communicate data between the borrower device (201) and the lender device (203).

FIG. 11 illustrates a method to identify the criticality level/priority level of a memory region according to one embodiment. For example, the method of FIG. 11 can be used to determine any of the criticality levels (e.g., 401 to 415) in FIGS. 9 and 10.

In FIG. 11, the criticality level (421) of the content of a memory region can be determined based on the content category (431), the priority (433) of the application (e.g., 212) in control of the content, and/or the priority requested by the application (e.g., 212) for the content.

Different content categories can have predetermined weights. When an application allocates a memory page for storing data, the application can identify the content category (431) of the memory page, such as application state, historical/log data, media, sensor data, etc. The operating system (213) can assign predetermined weights for the criticality based on the content category (431).

Different applications can have predetermined weights for their criticality. A user of a user device may value the experience with one application (212) more than the experience with another application and thus customize the weight assignments to different applications. In some instances, different applications may have inter-dependency. Thus, an application that provides important services to other applications can be assigned a higher priority (433).

Different subsets of data of a same application and of a same content category (431) may have different priorities (435). When the application (212) is programmed to request a customized priority (435), the application (212) can make improved predictions (e.g., 439) based on information that may not be available to the operating system (213). When the application (212) does not request a customized priority (435), the operating system (213) can track the memory usage of the application (212) and request usage-based priority (435) for the content.

A predetermined function can be used to combine the content category (431), the application priority (433), . . . , and/or the requested priority (435) to generate the criticality level (421). For example, weights can be calculated for the content category (431), the application priority (433), . . . , the requested priority (435) and summed up to obtain a total weight as the criticality level (421). For example, the priorities (433 . . . , 435) can be summed to generate a weight that is applied to increase or decrease the weight of content category (431) through multiplication.

FIG. 12 shows a method to throttle network communications for memory as a service according to one embodiment. For example, the method of FIG. 12 can be implemented in the borrower device (201) illustrated in FIG. 2, 6, or 9. For example, the method of FIG. 12 can be implemented as the device A (101), the device B (103), or the server P (105) of FIG. 1 in borrowing memory.

At block 451, a communication connection (e.g., 205) is established between a borrower device (201) and a lender device (203). For example, the connection (205) can be over the networks and/or Internet (109) illustrated in FIG. 1.

At block 453, the borrower device (201) communicates with the lender device (203) to obtain permission for the borrower device (201) to use an amount of memory (202) loaned by the lender device (203) for access by the borrower device (201) over the communication connection (205).

At block 455, the operating system of the borrower device (201) allocates virtual memory to applications (e.g., 212) running in the borrower device (201).

At block 457, the operating system of the borrower device (201) configures the virtual memory to be hosted at least in part on the amount of memory (202) loaned by the lender device (203) to the borrower device (201).

At block 459, the borrower device (201) determines criticality levels (e.g., 401 to 415) of contents in memory regions (e.g., 291 to 299, 261 to 265, 273 to 275, and 281 to 283) used by the applications (e.g., 212).

At block 461, the borrower device (201) allocates network bandwidth of the communication connection (212), based on the criticality levels, to data communications used by the memory regions in accessing the amount of memory (202) loaned by the lender device (203) over the communication connection (205) to the borrower device (201).

The memory loaned by the lender device (203) can be in part borrowed by the lender device (203) from another device (e.g., 245).

The criticality levels (e.g., 401 to 415, 421) can be identified based at least in part on categories (431) of the contents, priorities (433) of the applications (e.g., 212) controlling the contents, or priorities (435) requested for the contents by the applications (e.g., 212), or any combination thereof.

For example, the applications (e.g., 212) can request the priorities (435) for the contents stored in the memory regions based on usage histories of the contents, predicted usages (e.g., 439) of the contents in a subsequent period of time, or usage frequencies (e.g., 437) of the contents, or any combination thereof. In some instances, the operating system (213) can collect the usage histories, determine predicted usages (e.g., 439) and/or usage frequency (e.g., 437), and/or calculate the requested priority (435) on behalf of an application (e.g., 212).

To allocate the network bandwidth, the operating system (213) of the borrower device (201) or the communication device (217) of the borrower device (201), can throttle/control the amounts of data communications used in a period of time for the memory regions over the communication connection in accessing the amount of memory (202), loaned by the lender device (203) to the borrower device (201), according to a ratio corresponding to the criticality levels of the contents in the memory regions. Thus, during the period of time, the communications used for the memory regions can be seen as being allowed according to the ratio; and the average speeds of the data communications for the different memory regions can be controlled to be proportional to the ratio.

In some instances, the borrower device (201) can predict the degradation in the network bandwidth of the communication connection in a subsequent period of time. In response, the operating system (213) can adjust hosting of virtual memory between local memory (211) of the borrower device and the amount of memory (203) loaned by the lender device (203) to the borrower device (201), according to the criticality levels of contents in the memory regions.

For example, the operating system (213) of the borrower device (201) can identify a first memory region having a criticality level lower than a second memory region. The operating system (213) can reconfigure the hosting of virtual memory such that a virtual memory region associated with the first memory region is migrated from being hosted or cached in the local memory (211) to being hosted in the amount of memory (202) loaned by the lender device (203) to the borrower device (201); and a virtual memory region associated with the second memory region can be migrated from being hosted in the amount of memory (202) loaned by the lender device (203) to the borrower device (201) to being hosted or cached in the local memory (211) of the borrower device (201).

In some embodiments, the memory management units (MMU) of computing devices are configured to accelerate the access to borrowed memory over a network connection.

For example, a memory management unit (MMU) (216) of a borrower device (201) can be configured not only to access the local random access memory (211) of the borrower device (201) over a memory bus, but also to use a communication device (217) to access borrowed memory (204) that is hosted in the loaned memory (202) of a lender device (203) over a network connection (205). The memory management units (MMU) (216) can access the loaned memory (202) in the lender device (203) using the communication device (217) in accordance with a physical address (257) translated from a virtual address (255) by the memory management units (MMU) (216), without a need to cause the processor(s) (215) of the borrower device (201) to execute instructions of its operating system (213).

For example, some routine operations performed by an operating system (213) in accessing the loaned memory (202) can be implemented in the memory management unit (MMU) (216), such that the routine operations can be performed without the processor(s) (215) executing instructions in their execution units. Such MMU implementation/support can improve the efficiency of the processor(s) (215) in accessing borrowed memory (204) that is physically in the loaned memory (202) of the lender devices (203).

In general, an operating system (213) can be programmed to handle more situations than what the memory management unit (MMU) (216) can handle. For example, when communications to access the loaned memory (202) over a network connection (205) encounter exceptional conditions that are beyond processing capability of the memory management unit (MMU) (216), the operating system (213) can be executed to handle such situations.

FIGS. 13-15 illustrate hardware accelerated configurations to access borrowed memory according to some embodiments. For example, the techniques of FIGS. 13-15 can be implemented in the system of FIG. 1 or 6, with the memory service techniques of FIG. 2 and the memory mapping techniques of FIG. 3.

In FIG. 13, the memory management unit (MMU) (216) of the borrower device (201) is configured to have a connection to the local random access memory (211) and a connection to the communication device (217) of the borrower device (201). In some instances, the communication device (217) is part of the memory management unit (MMU) (216).

A virtual to physical memory map (253) cached in the translation lookaside buffer (TLB) (251) contains information to translate a virtual address (255) to a physical address (257).

When an instruction is executed in the execution units (215) of the borrower device (201), a virtual address (255) stored in one of the registers (501) and/or generated by the execution units can be used to load an instruction, retrieve an operand, and/or store a computation result. In such a situation, the borrower device (201) accesses the virtual memory identified by the virtual address (255).

When the virtual memory identified by the virtual address (255) is hosted in a memory page (259) in the local memory (211), the physical address (257) is configured to be sufficient for the memory management unit (216) to address the memory page (259) for a memory operation (e.g., read or write).

When the virtual memory identified by the virtual address (255) is hosted in a memory page (260) in the loaned memory (202) that is physically inside the lender device (203), the physical address (257) is configured to include sufficient information for the communication device (217) to transmit the access request to the lender device (203) over the computer network connection (205).

For example, when the virtual memory identified by the virtual address (255) is hosted in a memory page (260) in the loaned memory (202), the physical address (257) can include a network address of the lender device (203) and a virtual memory address in a virtual memory space serviced by the operating system of the lender device (203). The memory management unit (MMU) (216) requests the communication device (217) to transmit an access request to the lender device (203) using the network address; and the access request includes the virtual address that identifies the memory page (260) in the lender device (203).

When the communication device (237) receives the access request, the communication device (237) can be configured to instruct the memory management unit (MMU) (236) to access the memory page (260) identified by the virtual address included in the access request from the borrower device (201), in a way similar to the processor(s) (235) instructing the memory management unit (MMU) (236) to access a virtual address. In some instances, the communication device (237) is part of the memory management unit (MMU) (236).

For example, when the virtual address is translated into a physical address of the memory page (260) using a virtual to physical memory map of the lender device (203), the memory management unit (MMU) (236) performs the address translation and uses the physical memory address to access the memory page (260). When the virtual to physical memory map for the translation of the virtual address is not already in the memory management unit (MMU) (236) of the lender device (203), the operating system (233) of the lender device (203) can be executed to load a relevant portion of the virtual to physical memory map into the memory management unit (MMU) (236) of the lender device (203) such that the memory management unit (MMU) (236) can perform the address translation to access the memory page (260).

In some instances, the lender device (203) can host the virtual address used by the borrower device (201) in the storage device (232). In response to a failure/page fault in the memory management unit (MMU) (236) to translate the virtual address, the memory management unit (MMU) (236) causes the processor(s) (235) to execute the operating system (233), which loads the data content from the storage device (232) into the loaned memory (202), updates the translation lookaside buffer (TLB) of the memory management unit (MMU) (236) to facilitate the access. Alternatively, the operating system (233) may service the access request directly from the storage device, without caching or buffering or re-hosting it in the local memory (231) of the lender device (203).

In some instances, the lender device (203) can host the virtual address used by the borrower device (201) in another lender device (e.g., 205). In such a situation, the lender device (203) can access its lender (e.g., 205) in a way similar to the borrower device (201) accessing the lender device (203).

Optionally, when the virtual address (255) being accessed in the one of the execution units (215) of the borrower device (201) is translated into the physical address (257) for access via the communication device (217), the communication device (217) can migrate a virtual address region from the lender device (203) into the buffer (505) of the communication device (217), as illustrated in FIG. 14.

For example, when a virtual address (255) in a page of virtual memory is being accessed, the communication device (217) can migrate the entire page (or a portion of it) into the buffer (505) of the communication device (217) in anticipation of further accesses to the page.

Alternatively, the memory management unit (MMU) (216) of the borrower device (201) can be configured to reserve a portion of the local random access memory (211) as a buffer for caching a portion of the loaned memory (203), as illustrated in FIG. 15.

Optionally, the memory management unit (MMU) (216) of the borrower device (201) can be further configured to manage the adjustment of hosting of virtual memory regions identified in the virtual physical memory page (253) in a way similar to that illustrated in FIG. 5.

For example, when the memory management unit (MMU) (216) determines that a virtual region hosted in the loaned memory (202) of the lender device (203) is accessed more frequently and/or recently than a virtual region hosted in the local memory (211), the memory management unit (MMU) (216) can use the communication device (217) to migrate the more frequently and/or recently accessed virtual region into being hosted in the local memory (211) and evict the less frequently and/or recently accessed virtual region into being hosted in the loaned memory (202). Thus, the memory management unit (MMU) (216) can optimize the hosting of virtual memory regions identified in the virtual to physical memory map (253) cached in the translation lookaside buffer (TLB) (251) and update the virtual to physical memory map (253) cached in the translation lookaside buffer (TLB) (251) according to the adjustments. The operating system (213) of the borrower device (201) can be used to further adjust hosting of other virtual memory regions.

FIGS. 16 and 17 illustrate hardware accelerated configurations to provide access to loaned memory according to some embodiments. For example, the configuration of the lender device (203) illustrated in FIG. 13, 14 or 15 can be replaced with the configuration of FIG. 16 or 17.

In FIG. 16, the lender device (203) has a peripheral bus (511) and a memory bus (513).

A communication device (237) and a storage device (232) of the lender device (203) are connected to the processor(s) (235) of the lender device (203) via the peripheral bus (511). Local random access memory (231) of the lender device (203) is connected to the processor(s) via the memory bus (513).

The operating system (233) can be initially stored in the storage device (232) and subsequently loaded into the random access memory (231) for execution.

When the communication device (237) receives a memory access request (507) that identifies a virtual memory address (509) allocated by the operating system (233) for the borrowed memory (204) used by the borrower device (201), the communication device (237) is configured to request the processor (235) to process according to the memory access request (509).

At the time of the communication device (237) receiving the access request (507), the operating system (233) running in the lender device (203) may host the virtual address (509) in the storage device (232) or in the random access memory (231) (e.g., via the configuration of the memory map (227)).

If the virtual address (509) is hosted in the memory (231) and the memory management unit (MMU) (236) has a cached portion of the memory map (227) to translate the virtual address (509), the processor(s) (235) can process the access request (507) by accessing a physical address of the memory page (260) determined from the cached portion of the memory map (227).

If the virtual address (509) is hosted in the memory (231) and the memory management unit (MMU) (236) does not have a cached portion of the memory map (227) to translate the virtual address (509), the processor(s) (235) can execute the operating system (233) to update the cached portion of the memory map (227) such that the memory management unit (MMU) (236) can translate the virtual address (509) into the physical address of the memory page (260).

If the virtual address (509) is hosted in the storage device (232), such as a hard drive or a solid state drive, the memory management unit (MMU) (236) does not have a cached portion of the memory map (227) to translate the virtual address (509) (e.g., by generating a page fault). In response, the memory management unit (MMU) (236) causes the processor(s) (235) to execute the operating system (233), which can be configured to implement the access request (507) through accessing the storage device (232) and/or migrate a virtual memory region (e.g., a virtual memory page) into the random access memory (231).

If the virtual address (509) is hosted in another lender device (e.g., 245), the lender device (203) translates the virtual address (509) into a physical address that identifies a network address of its lender device (e.g., 245) and a virtual address assigned by its lender device (e.g., 245) (which can be optionally configured to be the same as the virtual address (509) in a unified address space). Then, the lender device (203) can access its lender device (e.g., 245) in a way similar to the borrower device (201) accessing the lender device (203).

The access request (507) can be configured in a form corresponding to the memory access requested during the instruction execution in the processor(s) (215) of the borrower device (201). For example, when a processor (215) of the borrower device (201) requests the loading of the instruction from a virtual address (255), the access request (507) is configured to request the retrieval of an instruction from the virtual address (509) (which can be optionally configured to be the same as the virtual address (255) in a unified address space).

For example, when a processor (215) of the borrower device (201) requests the loading of an operand from a virtual address (255), the access request (507) is configured to request the retrieval of the operand from the virtual address (509); and when a processor (215) of the borrower device (201) requests the storing of a computation result at a virtual address (255), the access request (507) is configured to request the retrieval of the operand from the virtual address (509).

Optionally, the access request (507) can be configured to implement migration of virtual address regions. For example, when the virtual address (509) is accessed, the communication device (237) is configured to automatically facilitate the migration of a virtual memory region between the lender device (203) and the borrower device (201).

Optionally, the communication device (237) is implemented as part of the memory management unit (MMU) (236) of the lender device (203).

Optionally, the memory management unit (MMU) (236) is configured to include a network controller (523) to operate the communication device (237), as illustrated in FIG. 17.

In FIG. 17, the memory management unit (MMU) (236) has a memory controller (521) configured to access the memory page (260) using a physical address for the memory (231). Further, the memory management unit (MMU) (236) has a network controller (521) configured to process network based memory access requests (e.g., 507). Such a network based memory access request (507) can be a request from its borrower device (e.g., 201), or its lender device (e.g., 245).

FIG. 18 shows a method to accelerate access to borrowed memory via a memory management unit according to one embodiment. For example, the method of FIG. 18 can be implemented in a device A (101) or device B (103), or a server P (105) illustrated in FIG. 1. For example, the method of FIG. 18 can be implemented in a borrower device (201) illustrated in FIG. 2, 6, 9, 13, 14 or 15. For example, the method of FIG. 18 can be implemented in a memory management unit (216) or a memory management unit (236) illustrated in FIG. 2, 3, or 13 to 17.

At block 531 in FIG. 18, a memory management unit (e.g., 216 or 236) caches a virtual to physical memory map (e.g., 253) in a translation lookaside buffer (e.g., 253) of the memory management unit (e.g., 216 or 236).

For example, the virtual to physical memory map (e.g., 253) can be a portion of page tables managed by the operating system (e.g., 213 or 233) of the computing device (e.g., 201 or 203) in which the memory management unit (e.g., 216 or 236) is configured.

At block 533, the memory management unit (e.g., 216 or 236) receives a request to access a virtual memory address (e.g., 255 or 509) for the execution of an instruction in a microprocessor (e.g., 215 or 235).

For example, the virtual memory address (255) can be stored in the registers (501) for the execution of the instruction in the processor (215). The virtual memory address (255) can be used to load the instruction from virtual memory address (255), to load an operand of the instruction from the virtual memory address (255), or to store a computing result generated by the execution units (503) after the execution of the instruction.

In some instances, the virtual memory address (509) is received in a communication device (237) in a memory access request from a network connection to a borrower device (e.g., 201); and the communication device (237) is configured to request the memory management unit (236) to process the access request (507).

At block 535, the memory management unit (e.g., 216 or 236) translates the virtual memory address (e.g., 255) into a physical memory address (e.g., 257) using the virtual to physical memory map (e.g., 253) cached in the translation lookaside buffer (e.g., 253).

At block 537, it is determined whether or not the physical memory address (e.g., 257) is for local memory (e.g., 211 or 231).

For example, the memory management unit (e.g., 216 or 236) can have connections to both a memory bus (e.g., 511) via a memory controller (e.g., 521) and a computer network (e.g., 109) via a network controller (523).

At block 539, if the physical memory address (e.g., 257) is determined (537) to be for the local memory (e.g., 211 or 231) (e.g., of a first memory type), the memory management unit (e.g., 216 or 236) instructs a memory controller (521) connected to a memory bus (513) to access a memory page (259) at the physical address (257).

At block 541, if the physical memory address (e.g., 257) is determined (537) not to be for the local memory (e.g., 211 or 231) (e.g., of a second memory type), the memory management unit (e.g., 216 or 236) instructs a network controller (523) connected to a computer network connection (205) to access a memory page (260) according to the physical address (257).

A memory management unit (MMU) (216 or 236) configured to perform the method of FIG. 18 can be used in a microprocessor (215 or 235) of a borrower device (201) or a lender device (203) that borrows memory for another device (e.g., 245).

A communication device (e.g., 201 or 203) having such a memory management unit (MMU) (216 or 236) can have a memory bus coupled to local random access memory (e.g., 211 or 213), and at least one microprocessor (e.g., 215 or 235). The microprocessor (e.g., 215) can further have registers (e.g., 501), and execution units (e.g., 503).

The computing device (e.g., 201 or 203) has an operating system (e.g., 213 or 233), including instructions, which when executed by the at least one microprocessor (e.g., 215 or 235), cause the computing device to borrow an amount of memory from a lender device (e.g., 203 or 245) over a network connection (205) using a communication device (e.g., 217 or 237).

The execution units (503) are configured to execute instructions using at least virtual memory addresses mapped to the amount of memory borrowed from the lender device (e.g., 203 or 245).

For example, after retrieving a first virtual memory address (255) from the registers (501) for the execution of an instruction in the execution units (503), the memory management unit (MMU) (216) translates the first virtual memory address (255) into a first physical address (257) that identifies the lender device (e.g., 203 or 245) over the network connection (205) and a second virtual memory address (509). The memory management unit (MMU) (216) instructs the communication device (217) to access, using the second virtual memory address, the memory (260) loaned by the lender device (203) to the computing device (201) over the network connection (205).

For example, the first physical address (257) can include a computer network address of the lender device (203).

The execution of the instruction in the execution units (503) can generate a memory operation to read or write at the first virtual memory address (255); and the memory management unit (253) is configured to generate a request (507) for the memory operation at the second virtual memory address (509) and instruct the communication device (217) to transmit the request (507) to the lender device (203) over the communication connection (205).

Operationally, the second virtual memory address (509) can be equal to the first virtual memory address (255) such that the lender device (203) and the borrower device (201) can use a unified virtual address space. For example, the operating system can be configured to receive the identification of the amount of borrowed memory (204) based on virtual memory addresses specified by the lender device (203) in the unified virtual address space; and the operating system can be configured to allocate virtual memory to applications directly from the virtual memory addresses in the unified virtual address space.

Optionally, the memory management unit (217) includes a buffer (505); and the memory management unit (216) is further configured to instruct the communication device (217) to communicate with the lender device (203) to establish a cache, in the buffer (505), for a portion of the amount of the memory (202) loaned by the lender device (203) to the borrower device (201), in response to the first virtual memory address (255) being received from the registers (501). For example, the communication device (217) can cache a page of memory according to a page table when the virtual address (255) in the page table is used.

Optionally, the memory management unit (217) is further configured to dynamically change from memory mappings between virtual memory and physical memory. For example, virtual memory identified by a set of virtual memory addresses can be initially mapped (e.g., in the translation lookaside buffer (TLB) (251)) to the memory (202) loaned by the lender device (203) to the borrower device; and the mapping can be changed to re-map the virtual memory to a portion of the local random access memory (211).

For example, the memory management unit (217) can swap the mapping of two virtual memory regions identified in the virtual to physical memory map (253) cached in the translation lookaside buffer (TLB) (251) such that a first virtual memory region initially mapped onto a region in the local memory (211) is re-mapped to a region in the loaned memory (202) in the lender device (203), and the second virtual memory region initially mapped onto the region (or another region) in the loaned memory (202) in the lender device (203) is re-mapped to the region (or another region) in the local memory (211).

For example, the memory management unit (217) can be further configured to identify the first virtual memory region and the second memory region for swapping based on a memory usage history in a past period of time or a predicted memory usage in a subsequent period of time. For example, a least recently used and/or least frequently used virtual memory page can be swapped from the local memory (211) to the loaned memory (202); and a most recently used and/or most frequently used virtual memory page can be swapped to the local memory (211) from the loaned memory (202).

An Artificial Intelligent (AI) agent can be configured on a borrower device and/or a lender device to predict the degradation of the network connectivity for Memory as a Service (MaaS). In response to the prediction and in a time period before the occurrence of the degradation of the network connectivity, the operating systems of the borrower device and/or the lender device can identify content that may have a need to be migrated over the network connection in the time period of the network degradation or outage, and start the content migration before the network degradation or outage such that relevant content can be accessed locally during the network degradation or outage, and such that important data can be backed up at a safe location.

For example, data predicted to be used in a borrower device during the network degradation or outage can be prefetched to the borrower device based on the predicted usage and/or the criticality of the data.

For example, certain data that may be lost in a borrower device and/or predicted to have a need to be backed up in the lender device during the network degradation or outage (e.g., due to power loss in the borrower device or a hazardous condition that may be experienced by the borrower device) can be copied to the lender device to minimize the potential of data loss.

For example, when a phone detects that the user will be driving through a mountain area with unreliable cellular data connectivity, the AI agent running in the phone can prefetch to the local memory or storage of the borrower device maps and/or other critical data for services in the mountain area. Data predicted to be unused during the time period can be copied into, or swapped into, the memory loaned by a lender device/server to the borrower device to make room in the phone for the prefetched content.

For example, a drone can be scheduled to depart for a mission-critical task; and based on the scheduled task/operation, the drone can prefetch data that will be used in that specific task/operation (e.g., feature extraction library and/or artificial neural network models to detect certain objects, such as tanks).

For example, a phone or a wearable device can detect that battery is dropping below a threshold level (e.g., 50%); and in response to a predicted power outage that may occur during the time period of network degradation or outage (e.g., determined based on power usage history and/or location history/schedule), the device can push certain important data to its memory borrowed from a lender device or server to avoid data loss.

FIGS. 19 and 20 illustrate a borrower device and a lender device configured to perform intelligent content migration according to some embodiments.

For example, the techniques of FIGS. 19-20 can be implemented in the system of FIG. 1 or 6, with the memory service techniques of FIG. 2 and the memory mapping techniques of FIG. 3. The content migration can be accelerated via the memory management units (216 and 236) discussed in connection with FIGS. 13-18.

In FIG. 19, the borrower device (201) has an Artificial Intelligent (AI) agent (571) that is optionally configured as part of the operating system (213). The AI agent (571) is configured to generate content migration decisions (580) based on various information collected by the operating system (213), such as a memory usage history (573), a location history (575), scheduled operations (577), battery power level (579) (e.g., when the borrower device (201) is power via battery), battery usage history, etc.

The AI agent (571) can be configured to rank the likelihood of different memory regions being used in a time period of predicted network degradation/outage, based on the information (573, 575, 577, . . . , and/or 579) collected by the operating system (213). For example, an artificial neural network can be trained to generate scores ranking the likelihood of different memory regions (e.g., 263, 265, . . . illustrated in FIG. 10) being used in the network based on the timing of the information (573, 575, 577, . . . , and/or 579).

Based on the likelihood of different memory regions being used in a subsequent period of time and/or the criticality (e.g., 421 illustrated in FIG. 11) of the content of the memory regions, the AI agent (571) can generate the migration decisions (580) to change the physical memory regions on which virtual memory regions are hosted.

For example, virtual memory regions that are likely to be used during the network degradation or outage can be migrated from being hosted on the borrowed memory (204) that is physically in another device (e.g., 103, 105, 107) to being hosted on the local random access memory (211) or a local storage device (232) of the borrower device (201). For example, the local storage device (232) can be a flash drive/memory, a solid state drive, a hard drive, etc.

For example, virtual memory regions that are not likely to be used in the borrower device (201) until after the network degradation or outage can be migrated in the opposite direction, from being hosted on the local random access memory (211) or a local storage device (232) of the borrower device (201) to being hosted on the borrowed memory (204) that is physically in another device (e.g., 103, 105, 107, or 203). Migration from local memory/storage to borrowed/loaned memory can also be used as a way to save or backup important data to a location (e.g., a lender device or server) that is more reliable than the borrower device (201) in preserving the data.

The AI agent (571) can be configured to score virtual memory regions for migration based on not only the likelihood of the virtual memory regions being used, but also the criticality (421) of the virtual memory regions for the desired functionality associated with the virtual memory regions, and the performance level of the network connection during the time period of the predicted network degradation or outage. The benefit scored for migrating the virtual memory regions can be measured against the cost of proactively migrating the virtual memory regions, which can degrade the performance for the time period of prefetching/migration and/or can incur unnecessary cost when the migrated data is eventually not used. When the benefit score is higher than the cost score for migrating a virtual memory region, the AI agent (571) can decide to migrate the virtual memory region to one or more lender devices (e.g., 103, 105, 107, or 203).

Optionally, the AI agent (571) can be implemented at least in part in a lender device (e.g., 103, 105, 107, or 203), as illustrated in FIG. 20.

For example, the lender device (e.g., 203) can include an AI agent (572) that monitors the usage of loaned memory (202) used by the borrower device (e.g., 201). The operating system (233) of the lender device (e.g., 203) can track the memory usage history (573) of the borrower device (201), the location history (575) of the borrower device (201), the scheduled operations (577) of the borrower device (201), etc. The borrower device (201) can provide certain information related to the status of the borrower device (201), such as the battery power level (579) of the borrower device (201), the current location of the borrower device (201), scheduled operations (577) of the borrower device (201).

For example, the borrower device (201) can share information (e.g., 573 to 579) about its operations by storing the information (e.g., 573 to 579) in the borrowed memory (204) that is loaned by the lender device (203) to the borrower device (201). Thus, the lender device (203) and the borrower device (201) can share the information (e.g., 573 to 579) through Memory as a Service (MaaS).

Further, the AI agent(s) (571 and/or 572) can be configured to run in the loaned memory (202)/borrowed memory (204). Thus, the lender device (203) and the borrower device (201) can run the AI agent(s) (571 and/or 572) in a collaborative way.

For example, the borrower device (201) can execute the AI agent (571) to provide and/or update information about the borrower device (201), such as the location history (575) and the battery power level (579), and then request the lender device (201) to execute the AI agent (571/572) to make migration decisions (580).

For example, the borrower device (201) can allocate a virtual memory region for running the AI agent (571). The virtual memory region can be initially hosted (or cached) in the local memory (211) of the borrower device (201) to provide and/or update the information (e.g., 573, 575, 577, . . . , and/or 579), which can also be stored in the virtual memory region. Subsequently, the borrower device (201) can migrate the virtual memory region to the borrowed memory (204); and the content of the virtual memory region is stored in the loaned memory (202) of the lender device (203). The lender device (203) can continue the execution of the AI agent (571) (e.g., as the AI agent (572)) to make the migration decisions (580). The borrower device (201) may further run the AI agent (571) to provide additional information and/or update status for future migration decisions (580). Thus, the borrower device (201) can provide the data used by the AI agent (571/572); and the lender device (203) can provide the computing power to process the data.

In some embodiments, the computing devices (e.g., 201 and 203, or 101 to 107 in FIG. 1) are configured with Memory as a Service that allow the migration of the hosting of a virtual memory region freely between/among the computing devices. When the virtual memory region is hosted on one of the devices, the device currently hosting the virtual memory region functions as a lender providing its memory resources to the other computing device(s) for the virtual memory region. When the hosting of the virtual memory region is migrated to another device, that device functions as a lender providing its memory resources to the other computing device(s) for the virtual memory region. A given computing device can function as a lender for a set of virtual memory regions and a borrower for another set of virtual memory regions; and the role of the computing device as a borrower or a lender can change dynamically from time to time for a specific virtual memory region. A computing device having large local memory resources can host more virtual memory regions than other computing device(s). The computing devices can share their local memory resources via Memory as a Service (MaaS). When the network connection (e.g., 205) is available, the virtual memory regions can migrate freely from one device to another device (e.g., in a system illustrated in FIG. 1).

FIGS. 21-24 illustrate content movements according to some embodiments.

FIG. 21 illustrates a borrower device (201) borrowing the memory resources of the lender device (203) for a virtual address region (581). The borrower device (201) stores a memory map (207) that associates the virtual address region (581) with the lender device identifier (583).

For example, the lender device identifier (583) can be an internet protocol (IP) address of the lender device, a host name of the lender device (203), a Uniform Resource Locator (URL) of the lender device (203), a Universally Unique Identifier (UUID), etc.

Based on the lender device identifier (583), the borrower device (201) can access the physical memory region (586) in the lender device (203). For example, the MMU (216) of the borrower device (201), or the operating system (213) of the borrower device (201) running in the processor(s) (215) of the borrower device (201), can generate a memory access request (507) illustrated in FIG. 17. The request (507) to store data in, or load data from, a virtual address (509) in the virtual address region (581) is transmitted over the network connection (205) in accordance with the lender device identifier (583). The lender device (201) receiving the request (507) can store data in, or load data from, a memory page (e.g., 260 illustrated in FIG. 17) in the memory region (586) identified by the memory map (227) maintained by the operating system (233) of the lender device (203).

In FIG. 21, the memory map (227) of the lender device (203) associates the virtual address region (581) with the lender device identifier (583), which indicates that the virtual address region (581) is hosted in the lender device (203). The memory map (227) of the lender device (203) maps the virtual address region (581) to a physical address region (586), which allows the MMU (236) of the lender device (203) to translate a virtual address (509) in the virtual address region (581) into a physical address in the physical address region (585). The physical address region (585) can identify a memory region (586) in the local memory (593 or 231) of the lender device (203). The physical address in the physical address region (585) can be used to access a memory page (260) in the memory region (586).

FIG. 22 illustrates the result of migrating the hosting of the virtual address region from the lender device (203) to the borrower device (201). After copying the content from the memory region (586) in the local memory (593 or 231) of the lender device (203) to a memory region (588) in the local memory (591 or 211) of the borrower device (201), the borrower device (201) can update its memory map (207) to associate the virtual address region (581) with the borrower device identifier (582), which indicates that the virtual address region (581) is hosted in the borrower device (201). Further, the memory map (207) maps the virtual address region (581) into a physical address region (587). Thus, a virtual address (255) in the virtual address region (581) can be translated into a physical address (257) in the physical address region (587) (e.g., as illustrated in FIG. 3).

In FIG. 22, the lender device (203) updates its memory map (227) to associate the borrower device (582), which indicates that the virtual address region (581) is hosted in the borrower device (201). Further, the virtual address region (581) is no longer mapped to a physical address region (585) of the memory region (586). Thus, the memory region (586) previously used to host the virtual address region (581) can be freed and can be used to host another virtual address region.

The configuration of FIG. 22 reflects the borrowing of the memory region (588) by the lender device (203) for the virtual address region (581). When the lender device (203) accesses a virtual address in the virtual address region (581), the lender device (203) can access the memory (588) loaned by the borrower device (201) to the lender device (203), in a way similar to the borrower device (201) accessing the memory (586) loaned by the lender device (203) to the borrower device (201) with the configuration of FIG. 21. Thus, the lender/borrower roles can be reversed through migrating the hosting of the virtual address region (581); and a given device can have different lender/borrower roles with respect to different virtual address regions that are hosted in location memory of different devices.

FIG. 23 illustrates a configuration where the virtual address region (581) is associated with the borrower device identifier (582) and thus hosted in the memory region (588) in the local memory (591 or 211) of the borrower device (201). However, the memory map (227) of the lender device (203) further associates the virtual address region (581) with the physical address region (585) of the memory region (586) in the local memory (593 or 231) of the lender device (203). Thus, the content in the memory region (586) of the lender device (203) can be used as a backup copy, a cache copy, or a mirror copy, of the content in the memory region (588) in the borrower device (201), in which is the virtual address region (581) is officially hosted.

Similarly, FIG. 24 illustrates a configuration where the virtual address region (581) is associated with the lender device identifier (583) and thus hosted in the memory region (586) in the local memory (593 or 231) of the lender device (203). However, the memory map (207) of the borrower device (201) further associates the virtual address region (581) with the physical address region (587) of the memory region (588) in the local memory (591 or 211) of the borrower device (201). Thus, the content in the memory region (588) of the borrower device (203) can be used as a backup copy, a cache copy, or a mirror copy, of the content in the memory region (586) in the lender device (203), in which is the virtual address region (581) is officially hosted.

Optionally, the devices (201 and 203) can also be configured to host, backup, cache, or mirror the contents in a local storage device (e.g., 232).

Using the techniques of FIGS. 21-24, contents of a virtual address region (581) can be migrated, mirrored, backed up, or cached in different devices (e.g., 201 and 203) according to the migration decisions (580).

FIG. 25 shows a method to migrate content in a computing system having borrowed memory according to some embodiments.

For example, the method of FIG. 25 can be implemented in a computing system illustrated in FIG. 1, 2, 13, 14, 21, 22, 23, or 24.

At block 601, a first computing device (e.g., 201) and a second computing device (e.g., 203) are connected via a computer network (e.g., 109).

At block 603, the first and second computing devices (e.g., 201 and 203) provision memory resources for access through virtual memory addresses across the computer network (e.g., 109).

For example, the first computing device (e.g., 201) can borrow memory from the second computing device (e.g., 203) (e.g., as illustrated in FIG. 21 or 24); and the second computing device (e.g., 203) can borrow memory from the first computing device (e.g., 201) (e.g., as illustrated in FIG. 22 or 23).

At block 605, the first and second computing devices (e.g., 201 and 203) map a first portion (e.g., 263) of the virtual memory addresses into the first computing device (201) (e.g., region 283, memory 211, unit 259 illustrated in FIG. 3) and a second portion of the virtual memory addresses (e.g., 265) into the second computing device (203) (e.g., region 275, memory 202, unit 260 illustrated in FIG. 3).

At block 607, the first and second computing devices (e.g., 201 and 203) predict a time period during which the network connection (e.g., 205) between the first and second computing devices (e.g., 201 and 203) degrades.

At block 609, the first and second computing devices (e.g., 201 and 203) make a migration decision (580) for content of a first virtual memory address region (581) based on the prediction of the time period.

At block 611, the first and second computing devices (e.g., 201 and 203) communicate the content of the virtual memory address region (581) between the first and second computing devices (e.g., 201 and 203), prior to the time period and in response to the migration decision.

For example, an AI agent (571/572) configured in the first and second computing devices (e.g., 201 and 203) can make the migration decision (580) based on a memory usage history (573), a location history (575), scheduled operations (577), a battery power level (579), a battery usage history, etc.

For example, the AI agent (571/572) can predict a usage of the virtual memory address region (581); and the usage is predicted to occur in the first computing device (e.g., 201) during the time period of network degradation. When the virtual memory address region (581) is currently being mapped to the local memory (or storage) (593) of the second computing device (203), a migration decision (580) can be made to make the content available in the local memory (or storage) (591) such that the content is accessible even when the network connection (205) is not available during the predicted time period of network degradation.

In another example, the AI agent (571/572) can predict that the content of a virtual memory address region (581) may be lost during the time period (e.g., due to the lack of battery power, or a hazardous condition). When the virtual memory address region (581) is currently being mapped to the local memory (or storage) (591) of the first computing device (201), a migration decision (580) can be made to make the content available in the local memory (or storage) (593) such that the content is preserved even when the network connection (205) is not available during the predicted time period to back up the content.

In response to the migration decision (580) and after storing the migrated content of the virtual address region (581) into the local memory (or storage) (591) of the first computing device (e.g., 201), the memory mapping of the virtual memory address region (581) can be changed by mapping the virtual memory address region (581) into the local memory (or storage) (591) of the first computing device (e.g., 201), as illustrated in FIG. 22 or 23.

Similarly, in response to the migration decision (580) and after storing the migrated content of the virtual address region (581) into the local memory (or storage) (593) of the second computing device (e.g., 203), the memory mapping of the virtual memory address region (581) can be changed by mapping the virtual memory address region (581) into the local memory (or storage) (593) of the second computing device (e.g., 203), as illustrated in FIG. 21 or 24.

When the virtual memory address region (581) is mapped onto the local memory (or storage) (591) of the first computing device (201), the virtual memory address region (581) is associated in a memory map (227) of the second computing device (203) with an identifier (582) of the first computing device (201), as illustrated in FIGS. 22 and 23; and when the virtual memory address region (581) is mapped onto the local memory (or storage) (593) of the second computing device (203), the virtual memory address region (581) is associated in a memory map (207) of the first computing device (201) with an identifier (583) of the second computing device (203), as illustrated in FIGS. 21 and 24.

Optionally, the virtual memory address region (581) is mapped into the local memory (or storage) (591) of the first computing device (201), the virtual memory address region (581) is further associated in the memory map (207) of the first computing device (201) with the identifier (582) of the first computing device (201), as illustrated in FIGS. 22 and 23; and when the virtual memory address region (581) is mapped onto the local memory (or storage) (593) of the second computing device (203), the virtual memory address region (581) is further associated in the memory map (227) of the second computing device (203) with the identifier (583) of the second computing device (203), as illustrated in FIGS. 21 and 24.

When the virtual memory address region (581) is mapped onto the local memory (or storage) (591) of the first computing device (201), the memory map (207) of the first computing device (201) maps the virtual memory address region (581) to a physical memory address region (587/588) in the local memory (or storage) (591) of the first computing device (201), as illustrated in FIGS. 22 and 23; and when the virtual memory address region (581) is mapped onto the local memory (or storage) (593) of the second computing device (203), the memory map (227) of the second computing device (203) maps the virtual memory address region (581) to a physical memory address region (585/586) in the local memory (or storage) (593) of the second computing device (203), as illustrated in FIGS. 21 and 24. The content migration is performed by copying the content between the physical memory address region (587/588) of the first computing device (201) and the physical memory address region (585/586) of the second computing device (203).

Optionally, after the virtual memory address region (581) is mapped onto the local memory (or storage) (591) of the first computing device (201), the second computing device (203) can configure the physical memory address region (585/586) in the second computing device (203) to store a cache, mirror, or backup copy of the content of the virtual memory address region (581), as illustrated in FIG. 23.

Similarly, after the virtual memory address region (581) is mapped onto the local memory (or storage) (593) of the second computing device (203), the first computing device (201) can configure the physical memory address region (587/588) in the first computing device (201) to store a cache, mirror, or backup copy of the content of the virtual memory address region (581), as illustrated in FIG. 24.

The migration decision (580) can be made based on a predicted location of the first computing device, a scheduled operation of the first computing device (201), an identification of the software/data to be used for the scheduled operation, a predicted operation of the first computing device (201) identified from repeated operations in the past, a battery usage history of the first computing device, etc.

For example, the migration decision (580) can be made based at least in part on an artificial neural network stored in a portion of virtual memory addresses. The AI agent (571) running in the first computing device (201) can use the portion of the virtual memory addresses to provide data for the artificial neural network; and the AI agent (572) running in the second computing device (201) can use the portion of the virtual memory addresses to perform computation for the migration decision (580).

Memory as a Service (MaaS) supports a memory centric computing model. For example, MaaS allows the hosting of virtual memory to flow among networked computers. As a result, the content of the virtual memory can flow seamlessly among the processors of the computers. Therefore, the computers in the network can contribute computing resources, data, and/or computing results through sharing memory resources.

For example, a thin client can borrow memory from an appliance or server. By loaning the memory to the client, the processor(s) of the appliance or server can readily access the content in the memory borrowed by the client and perform computation on behalf of the client in response to a request for the client.

For example, the client can set up the computation in the borrowed memory and request the appliance or server to take over further computations. The borrowed memory can store the data and/or code for processing the data; and the appliance or server can operate on the data and/or execute the code, as if the computation were initially set up on the appliance or server. For example, the client can set up the computing task to provide data specific to the client; and the appliance or server can perform a processing intensive portion of the task for the client.

For example, the client can initially host a virtual memory region in the local memory of the client. Subsequently, the client may re-host the virtual memory region in the memory loaned by the appliance or server to the client. The client can request the appliance or server to continue execution of a routine or a set of instructions in the virtual memory region; and the appliance or server can optionally take control of the memory loaned to the client and execute the routine or instructions that can further process the data in the memory loaned to the client. After the completion of the request, the appliance or server can provide a notification to the client, causing the client to retrieve the computation results of the appliance or server and/or continue execution of routines or instructions in the virtual memory region. In some instances, an application is configured to run from the virtual memory region; and the execution of the application can be performed on the client at some stages and transferred to the appliance or server at other stages. Thus, the client and the appliance or server can share computation resources via sharing memory.

Similarly, an appliance or server can set up a task in memory, lend the memory to a client (e.g., an edge computing device), request the client to perform local computing on data of the client, and obtain the result back in the memory.

Further, the appliance or server can set up the tasks in multiple memory regions that are loaned to multiple clients. The clients can provide inputs to the appliance or server by running the tasks in their respective borrowed memory regions. Thus, Memory as a Service (MaaS) can enable new memory centric computing models.

FIGS. 26 and 27 illustrate distributed computing based on selectively hosting a virtual address region on local memory of different computers, such as a device (621) and an appliance/server (623).

In general, the device (621) can be a device (101 or 103) or server (105) in FIG. 1, or a borrower device (201) in FIGS. 2, 6, 9, 13-15, 19, and/or 21-24.

In general, the appliance/server (623) can be a device (103) or server (105 or 107) in FIG. 1, or a lender device (203) in FIGS. 2, 6, 13-17, 20, and/or 21-24.

In FIG. 26, the device (621) allocates a virtual address region (581) for an application (212). The virtual address region (581) can be hosted in the local memory (211) of the device (621) for a time period in which the application (212) is being executed in the device (621).

For example, the virtual memory address region (581) is associated with the device identifier A (582) of the device (621) in both the memory map (207) of the device (621) and the memory map (227) of the appliance/server (623). The memory map (207) of the device (621) further associates the virtual memory address region (581) with a physical address region (587). Thus, the memory map (207) can be used by the processor(s) (215) running the application (212) to translate virtual addresses in the virtual address region (581) into corresponding physical addresses in the physical address region (587). The physical addresses can be used to access memory pages in the memory region (588) in the local memory (211) of the device (621).

For example, the application (212) running in the device (621) can use the virtual address region (581) to read data (625) in the memory region (588), operate on the data (625), and/or store the data (625) in the memory region (588).

The virtual address region (581) can be re-hosted in the local memory (231) of the appliance/server (623), as illustrated in FIG. 27. After transmitting the content of the memory region (588) in the local memory (211) to the appliance/server (623) and storing the content in the memory region (586) in the local memory (231) of the appliance/server (623), the virtual address region (581) is associated with the device identifier B (583) of the appliance/server (623) in both the memory map (227) of the device (623) and the memory map (227) of the appliance/server (623). Further, the memory map (227) of the device (621) associates the virtual memory address region (581) with a physical address region (585). Thus, the memory map (207) can be used by the processor(s) (235) of the appliance/server (623) running a corresponding application (234) to translate virtual addresses in the virtual address region (581) into corresponding physical addresses in the physical address region (585). The physical addresses can be used to access memory pages in the memory region (586) in the local memory (231) of the appliance/server (623).

For example, the application (234) running in the appliance/server (623) can use the virtual address region (581) to read data (625) in the memory region (586), operate on the data (625), and/or store the data (625) in the memory region (586).

The application (212) in the device (621) and the application (234) in the appliance/server (623) can be configured to use the same virtual address region (581) to share data, processing resource, and/or computation results.

In some instances, when the virtual address region (581) is re-hosted in the local memory (231) of the appliance/server (623), the device (621) can keep the memory region (588) for the virtual address region (581) as a backup, mirror, or cache copy of the content in the local memory (231) of the appliance/server (623). Optionally, the application (212) in the device (621) and the application (234) in the appliance/server (623) can run concurrently in the memory regions (588 and 586); and the applications (212 and 234) can communicate with each other with inter-process calls to coordinate processing tasks and data synchronization.

Optionally, applications (212 and 234) are a set of instructions executed as different processes in the device (621) and the appliance/server (623).

FIGS. 28 and 29 illustrate selectively running an application (627) on different computers at different stages of the execution of the application (627). In FIGS. 28 and 29, the application (627) (or a portion of it) is configured to reside in the virtual address region (581). The processor(s) (215) can load the application (627) from the virtual address region (581) for execution and for reading, processing, and/or storing data (625).

When the virtual address region (581) is hosted or cached in the local memory (211) of the device (621), the device (621) can execute the application (627). When the virtual address region (581) is hosted or cached in the local memory (231) of the appliance/server (623), the appliance/server (623) can execute the application (627).

Thus, the device (621) and the appliance/server (623) can coordinate with each other to run different stages of the execution of the application (627). For example, the device (621) can run the application (627) to set up data (625) for further processing (e.g., for a computational and/or resource intensive tasks). The applicant/server (623) can continue the execution of the application (627) for the further processing. After the further processing by the applicant/server (623), the device (621) can continue running the application (627) to use the computation results provided by the applicant/server (623).

In general, multiple virtual address regions (e.g., 581) can be used for the application (627) and its data (625). Some of the virtual address regions (e.g., 581) can be hosted on the device (621); and the other virtual address regions (e.g., 581) can be hosted on the appliance/server (623) (and/or another device).

FIGS. 30 and 31 illustrate running an application (627) in virtual machines (629) hosted on different computers (621 and 623).

For example, the processor(s) (215) of the device (621) and the processor(s) (235) of the appliance/server (623) can have different instruction sets. Thus, instructions of an application (627) may not be compatible for execution in both the processor(s) (215) of the device (621) and the processor(s) (235) of the appliance/server (623).

In FIGS. 30 and 31, the device (621) runs a virtual machine (629). The application (627) is configured to run within the virtual machine (629) that is compatible with the virtual machine (629) hosted in the appliance/server (623). Thus, when the virtual address region (581) is re-hosted on the appliance/server (623) (e.g., as illustrated in FIG. 31), the application (627) in the virtual address region (581) is executable in the virtual machine (629).

In some instances, the virtual machine (629) in the appliance/server (623) emulates the device (621). Thus, the application (627) can be executed in the device (621) in a native mode without a virtual machine; and the appliance/server (623) can continue the execution of the application (627) once the virtual address region (581) is re-hosted, or cached, or mirrored on the appliance/server (623).

When the virtual address region (581) is hosted on the appliance/server (623), the device (621) can have a cached or mirrored version of the virtual address region (581) in its local memory (211). The appliance/server (623) can execute the application (627) in the virtual address region (581) hosted in its memory region (586), while the device (621) can concurrently execute the application in the virtual address region (581) cached/mirrored in its memory region (588). For example, the running process of the application (627) in the device (621) can fork into two running processes. One of the processes continues in the device (621), and the other process runs in the appliance/server (623). The two running processes can communicate with each other to coordinate data processing and/or data synchronization. One of the running processes can be terminated at a suitable stage, after a period of parallel execution on the device (621) and the appliance/server (623).

FIG. 32 shows a method of distributed computing based on Memory as a Service (MaaS).

For example, the method of FIG. 32 can be implemented using a computing device and a remote device that is connected to the computing device through a computer network. The computing device and the remote device can be the device (621) and the appliance/server (623) illustrated in FIGS. 26-31. For example, the computing device and the remote device can be the borrower device (201) and the lender device (203) illustrated in FIGS. 2, 6, 9, 13 to 17, and/or 19-24. For example, the computing device and the remote device can be some of the devices (101, 103) and servers (105, 107) illustrated in FIG. 1.

At steps 651 and 671, a computing device borrows memory from a remote device; and the remote device loans the memory to the computing device.

At step 653, the computing device allocates a virtual memory address region (e.g., 581) to an application (e.g., 212 or 627) running in the computing device.

At step 655, the computing device maps the virtual memory address region (e.g., 581) into local memory (e.g., 211) of the computing device.

At step 657, the application (e.g., 212 or 627) running in the computing device stores data in the local memory (e.g., 211) of the computing device according to virtual memory addresses in the virtual memory address region, which is mapped onto the local memory (e.g., 211) of the computing device.

At step 659, the computing device transmits at least a portion of the content of the virtual memory address region (e.g., 581) to the remote device. At step 673, the remote device receives at least the portion of the content of the virtual memory address region (e.g., 581) from the computing device.

At steps 661 and 675, the computing device and the remote device communicate with each other to map the virtual memory address region (e.g., 581) into the borrowed portion of the local memory (e.g., 231) of the remote device.

At steps 663 and 677, the computing device sends to the remote device a request to process the data in the virtual memory address region (e.g., 581); and the remote device receives from the computing device the request to process the data in the virtual memory address region (e.g., 581).

At step 679, the remote device runs an application (e.g., 234 or 627) according to the request.

At step 681, the remote device allocates the virtual memory address region (e.g., 581) to the application (e.g., 234 or 627).

At step 683, the application (e.g., 234 or 627) running in the remote device processes the data using the virtual memory address region (e.g., 581) hosted in the remote device.

For example, the request can be sent (663) from the computing device to the remote device before the termination of the application (e.g., 212 or 627) running in the computing device. After the mapping of the virtual memory address region (e.g., 581) into the borrowed/loaned portion of the local memory of the remote device, the computing device can keep a memory region (e.g., 588) previously used to host the virtual memory address region (e.g., 581) as a backup, mirror, or cache copy of the virtual memory address region (e.g., 581) mapped to the remote device. Thus, the computing device and the remote device can run their applications (e.g., 212, 234 or 627) concurrently and/or in parallel on the separate copies of the content of the virtual memory address region (e.g., 581) (e.g., stored in the memory regions (588 and 586) respectively in the computing device and the remote device).

Optionally, the computing device and the remote device can communicate with each other to run their applications (e.g., 212, 234 or 627) in one of the devices at a time. For example, after the processing (683) performed in the remote device, the remote device can send a request to the computing device to cause the computing device to continue running the application (e.g., 212 or 627) that uses the results of the processing (683) performed in the remote device.

The content of the virtual memory address region (e.g., 581) can be updated for running the applications (e.g., 212, 234 or 627) through synchronization and/or re-hosting the virtual memory address region (e.g., 581). In some instances, the computing device can run the application directly on the virtual memory address region hosted on the remote device (e.g., using the memory access acceleration techniques discussed in connection with FIGS. 13-17). In some instances, the virtual memory address region (e.g., 581) is re-hosted back in the computing device, or cached/mirrored in the computing device, for the application (e.g., 212 or 627) running in the computing device.

Optionally, the applications (e.g., 212, 234 or 627) running the computing device and the remote device to use the same virtual memory address region (e.g., 581) can have the same set of instructions. Further, the set of instructions can be loaded by the computing device and/or the remote device into the virtual memory address region (e.g., 581) for execution, as illustrated in FIGS. 28-31. For example, a program counter in a processor of the computing device can store a virtual address in the virtual memory address region (e.g., 581); and the processor can retrieve an instruction of the application (e.g., 627) at the virtual address for the execution of the application (e.g., 627).

In some instances, a group of devices, similar to the computing device and the remote device discussed above, can be connected via a computer network to form a system. Each of the devices in the system can be configured via its operating system to: execute an application that accesses memory using a virtual memory address region; map the virtual memory address region to the local memory for a first period of time during which the application is being executed in the respective device; map the virtual memory address region to a local memory of a remote device in the plurality of computing devices for a second period of time after starting the application in the respective device and before terminating the application in the respective device; and request the remote device to process data in the virtual memory address region during at least the second period of time. The virtual memory address region can be dynamically re-hosted on any of the devices in the group to facilitate the computation using the instructions and/or data stored in the virtual memory address region.

When a memory fault occurs in the Memory Management Unit (MMU) during accessing a virtual memory region that is hosted on borrowed memory, the operating system of the borrower device can be executed to fetch the content of a memory region having the memory fault, and cache the virtual memory region in the local memory of the borrower device.

For example, when a memory fault occurs in a page of virtual memory of a predetermined size (e.g., 4 KB), the content of the entire memory page can be fetched from the lender device and cached in a page of the local memory of the borrower device. The operating system can then generate a page table entry to map the page of the virtual memory to the page of the local memory, and update the translation lookaside buffer (TLB) to handle the memory fault.

However, an application running in the processor may use only a portion of the page. In such a situation, migrating the content of the entire page, across the network connection from the lender device to the borrower device, to handle the memory fault is inefficient.

Preferably, the borrower device is configured to migrate a portion of the page, such as a cache line of a predetermined size (e.g., 64 bytes or 512 bits), in response to a memory fault in the page. The portion of the page that is being cached contains a memory location that is currently being accessed via a virtual memory address. Other portions of the page need not be cached in response to accessing the virtual memory address. Thus, the time period to handle the memory fault is reduced; and the efficiency of the network bandwidth usage is improved.

For example, a bitmask can be used to tag cache line availability in the local memory of the borrower device. Each bit in the bitmask is used to identify whether a cache line represented by the bit in the bitmask is available in the local memory. The memory management unit (MMU) can have a page table entry that maps a virtual memory page of borrowed memory to a page of local memory functioning as the cache of the borrowed memory page. Before the MMU accesses a memory location according to the physical memory address computed according to a page table entry, the borrower device can be configured to check the corresponding bit in the bitmask for the cache line containing the memory location. If the bit in the bitmask indicates that the cache line is not currently available in the local memory, the borrower device can fetch the cache line from the lender device, before causing the MMU to use the physical memory address.

Optionally, an application program can be coded to include instructions to check the bitmask. For example, when the application program requests the application of an amount of memory, the application program can also allocate a corresponding amount of memory for the bitmask for tracking the cache lines of the requested memory. A predetermined function/utility can be provided to check and implement the local availability of a cache line containing a memory location. If the bit in the bitmask for the cache line is not set, the operating system of the borrower device can be executed to fetch the cache line, just in time before accessing a memory location in the cache line. The application program can invoke the predetermined function/utility for a memory location before accessing the memory location.

For example, a compiler can recognize the memory accesses made in the application program and automatic inject the codes/instructions/calls to the function/utility to check and implement the availability of the cache line.

In some instances, an application program can include tags to selectively request the compiler to apply data migration at the level of cache line. For example, an amount of memory allocated for one purpose can be programmed to migrate at the level of memory page such that, when a memory page is not cached in the local memory, the entire memory page is fetched and cached. No bitmask is required/used to track local cache line availability for pages in this memory. In contrast, another amount of memory allocated for another purpose can be programmed to migrate at the level of cache line such that some cache lines in a memory page can be fetched, and cached locally, without caching other cache lines in the same memory page. A bitmask is used to track the local cache line availability.

In some embodiment, the memory management unit (MMU) is configured to perform fine grain data migration based on a bitmask. Prior to accessing a memory location according to a physical address, the MMU checks an associated bitmask to determine whether the corresponding cache line is available in the local memory of the borrower device. If the cache line is not currently available in the local memory, the MMU can raise a memory fault to cause the operating system to fetch the cache line, or control a communication device to fetch the cache line without invoking/running the operating system in fetching the cache line.

In general, a memory status map can be used to track the local availability of portions of a virtual memory region hosted on a remote lender computer. A bit in the status map can be used to indicate whether a portion corresponding to the bit is currently available/cached in the local memory of a borrower device.

Further, the borrower device and/or the lender device can track the data usage pattern of borrowed memory. A data migration granularity level can be determined based on the data usage pattern.

For example, to reduce the ratio between the payload and network communication protocol overhead, a smallest unit for data migration (e.g., a cache line of 64 bytes) can be predetermined for transmitting memory data between the borrower device and the lender device. Based on the data usage pattern of an application, the borrower device and/or the lender device can determine an optimized unit for data migration for a portion of borrowed memory (e.g., an optimized number of cache lines). Different portions of the borrowed memory can have different optimized units for data migration. The optimized units balance the benefit of reduction in latency and the cost of migrating data that is not required to be migrated.

FIG. 33 shows a memory status map configured to identify the cache status of contents of sub-regions.

In FIG. 33, a translation lookaside buffer (TLB) (251) stores a virtual to physical memory map (253) that defines the mapping between virtual address regions (e.g., 581) and physical address regions (e.g., 587).

In FIG. 33, the virtual address region (581) has a minimal size (e.g., a memory page of 4 KB) such that if any part of virtual addresses in the virtual address region (581) is defined in the translation lookaside buffer (TLB) (251), the remaining part of the virtual addresses in the virtual address region (581) is also defined in the translation lookaside buffer (TLB) (251). Therefore, if the virtual to physical memory map (253) can be used to translate a virtual address in the virtual address region (581), any address in the entire virtual address region (581) can be translated to a corresponding physical address in the region (587).

Preferably, the content of the virtual address region (581) can be migrated between a borrower device and a lender device one sub-region at a time.

In FIG. 33, a memory status map (701) is used to indicate the availability statuses (711, 713, . . . , 719) of sub-regions of the virtual address region (581). Each of the sub-regions can have a predetermined size (e.g., a cache line of 64 B). The content of a sub-region can be either hosted/cached in the local memory of the borrower device, or hosted/stored in the local memory of the lender device. The statuses (711, 713, . . . , 719) indicate whether the corresponding sub-regions are cached/hosted in the local memory. Using the memory status map (701) to track the statuses (711, 713, . . . , 719) of the local cache availability, data migration between the borrower device and the lender device can be performed for selected sub-regions (e.g., 711, 713, . . . ) but not for other sub-regions (e.g., 719, . . . ).

FIG. 34 illustrates the use of a memory status map to access borrowed memory that can be fetched/migrated at sub-region levels. For example, the virtual address region (581) and the memory status map (701) of FIG. 34 can be examples of the virtual address region (581) and the memory status map (701) in FIG. 33.

In FIG. 34, the virtual address region (581) have multiple sub-regions (721, 723, . . . , 729). When the mapping of any of the sub-regions (721, 723, . . . , 729) is defined in the translation lookaside buffer (251), all of the sub-regions (721, 723, . . . , 729) are also defined. Thus, the virtual address region (581) is a minimal unit in defining mapping to physical addresses in the translation lookaside buffer (251).

The bits (711, 713, . . . , 719) in the memory status map (701) correspond to the sub-regions (721, 723, . . . , 729) respectively. When a bit (e.g., 711) in the memory status map (701) has a first predetermined value (e.g., zero), the bit (e.g., 711) is used to indicate that the content of the corresponding sub-region (e.g., 721) is hosted in the remote memory region (586) (e.g., in a lender device (203) or an appliance/server (623)). When a bit (e.g., 713) in the memory status map (701) has a second predetermined value (e.g., one), the bit (e.g., 713) is used to indicate that the content of the corresponding sub-region (e.g., 723) is hosted in the local memory region (588) (e.g., in a borrower device (201) or a device (621)).

Using the memory status map (701), a borrower device (e.g., 101, 103, 105, 201 or 621) can determine whether or not to perform data migration across a network connection (e.g., 205) before using a physical address (257) converted from a virtual address (255) using the translation lookaside buffer (TLB) (251).

For example, the application (211) running in the borrower device can include instructions to allocate the memory status map (701) and then check the value of a corresponding bit (e.g., 711 or 713), before accessing the virtual address in the corresponding sub-region (e.g., 721 or 723). For example, a compiler can be configured to insert such instructions for memory usage that may rely upon borrowed memory.

For example, the virtual to physical memory map (253) can identify a local of the memory status map (701); and the memory management unit (MMU) (216) of the borrower device (e.g., 201 or 621) can be configured to check the memory status map (701).

If the corresponding bit in the memory status map (701) has the first predetermined value (e.g., zero), the memory management unit (MMU) (216) can generate a memory fault to request the operating system (213) of the borrower device to fetch the content from the sub-region (741) in the remote memory region (586) to the sub-region (731) in the local memory region (588). After the content of the sub-region (721) is hosted/cached in the local memory region (588), the memory management unit (MMU) (216) can use the physical address (257) to perform memory access requested by the processor (215) at the virtual address (255). Optionally, the memory management unit (MMU) (216) can be configured to fetch the content of the sub-region (721) using a communication device (217) without executing the operating system (213) of the borrower device.

If the corresponding bit in the memory status map (701) has the second predetermined value (e.g., one), the memory management unit (MMU) (216) can use the physical address (257) to perform memory access requested by the processor (215) at the virtual address (255).

FIG. 35 shows a borrower device (201) and a lender device (203) configured for fine grain data migration for borrowed memory.

In FIG. 35, the memory region (586) of the lender device (203) is loaned to the borrower device (201). The memory management unit (MMU) (216) of the borrower device (201) stores a virtual to physical memory map (253) in a way as discussed above in connection with FIGS. 33 and 34. The mapping in the virtual to physical memory map (253) is specified at a granularity level of the virtual address region (581). The borrower device (201) uses the local memory region (588) as the cache of the borrowed memory region (586) in the lender device (203).

The borrower device (201) stores a memory status map (701) for the virtual address region (581) to allow fine grain data migration at sub-region level as illustrated in FIG. 34.

The memory status map (701) can be managed by the application (212) using the virtual address region (581). For example, when the virtual address region (581) is allocated for use in the application (212), the application (212) can also allocate memory for the memory status map (701). The application includes instructions to check the memory status map (701) for local availability of sub-regions (721, 723, . . . , 729) before accessing the virtual addresses in the sub-regions (721, 723, . . . , 729). Such instructions can be inserted in an automated way using a compiler, or programmed by the programmer of the application (212).

Alternatively, or in combination, the memory status map (701) can be managed by the operating system (213). For example, when the operating system (213) updates the virtual to physical memory map (253) to access the remote memory region (586) borrowed from the lender device (203), the operating system (213) can allocate the memory for the memory status map (701). Before the virtual address region (581) is fully cached in the memory region (588), the memory management unit (MMU) (216) (or the instructions executed in the execution units (503)) can be configured to request the operating system (213) to check the memory status map (701) for local availability before accessing an address in the virtual address region (581).

Alternatively, or in combination, the memory status map (701) can be managed by the memory management unit (MMU) (216). For example, in response to a virtual address in the registers (501) being used to access memory in the virtual address region (581), the memory management unit (MMU) (216) can be configured to check the memory status map (701) for local availability. The memory status map (701) can be part of the memory region (588) allocated for the virtual address region (581), a portion of the local memory (211) associated with the memory region (588) by an indicator in the virtual to physical memory map (253) for the virtual address region, or a pre-reserved portion of the local memory (211) for the memory region (588). Optionally, the memory management unit (MMU) (216) can cache the memory status map (701), or a portion of it, to accelerate the local availability check.

When a sub-region (e.g., 721) being accessed is not currently available in the local memory (211), the memory management unit (MMU) (216) can request the operating system (213) to fetch the content from the corresponding remote sub-region (e.g., 741) to the local sub-region (e.g., 731). For example, the memory management unit (MMU) (216) can make the request via raising a memory fault.

Alternatively, the memory management unit (MMU) (216) can be configured to control the communication device (217) to access the remote memory region (586) directly, without executing the operating system (213). For example, the techniques of FIGS. 13-18 can be used to accelerate the data communication between the borrower device (201) and the lender device (203).

Optionally, the lender device (203) can also track the memory status map (701) in view of the data migration requests received from the borrower device (203). The lender device (203) can track the memory usage history (703) based on the changes of the memory status map (701) over a period of time. The memory usage history (703) can be used by the lender device (203) to predict the timing and patterns of sub-regions (721, 723, . . . , 729). Thus, the lender device (203) can schedule predictive data migration based for the sub-regions (721, 723, . . . , 729) to reduce cache miss for the sub-regions (721, 723, . . . , 729).

For example, the borrower device (201) can provide information that may be relevant to the prediction of the timing of the use of the sub-regions (721, 723, . . . , 729) in the borrower device (201). Examples of such information can include the identification of the application, an execution milestone in the application, etc. Such information can be collected as part of the memory usage history (703). An artificial intelligence (AI) engine in the lender device (201) can be configured to make sub-region usage predictions (e.g., using an artificial neural network (ANN)). The ANN can be optionally trained using usage histories from multiple borrower devices (e.g., 201) to determine the memory usage pattern of an application. Thus, the computing power and/or data in the lender device (203) can be used to boost the performance of the borrower device (201) in use borrowed memory.

Alternatively, or in combination, the borrower device (201) can also be configured to collect the memory usage history (703). For example, the borrower device (201) can share its memory usage history data with the lender device (203) by storing the data in a memory region that is loaned by the lender device (203) to the borrower device (201). For example, the lender device (203) can periodically update an ANN model for the prediction and share the model to the borrower device (201) via memory as a service, enabling the borrower device (201) to make improved predictions.

FIG. 36 shows a method of fine grain data migration for borrowed memory. For example, the method of FIG. 36 can be implemented in a borrower device (201) and/or a lender device (203) illustrated in FIGS. 2, 6, 9, 13 to 17, and/or 19-24, or the devices (101, 103) and servers (105, 107) illustrated in FIG. 1.

At block 751, a computing device (e.g., 201) borrows memory from a remote device (e.g., 203) over a computer network (e.g., 109).

At block 753, the computing device allocates a virtual memory address region (581) to address a portion (586) of the amount of memory loaned by the remote device to the computing device.

At block 755, the computing device configures a physical memory region (588) in the computing device as a cache of the portion (586) of the borrowed memory.

At block 757, the computing device stores a virtual to physical memory map (253) that identifies the mapping between the virtual memory address region (581) and a physical memory address region (587) corresponding to the physical memory region (588).

At block 759, the computing device stores a memory status map (701) identifying cache availability statuses (711, 713, . . . , 719) of sub-regions (721, 723, . . . , 729) of the virtual memory address region (581).

At block 761, the computing device converts a virtual memory address (255) into a physical memory address (257) using the virtual to physical memory map (253), before making memory access using the virtual memory address (255).

At blocks 763 and 765, the computing device identifies a sub-region (e.g., 721, 723, . . . , or 729) that contains the virtual memory address (255) and checks the cache availability status (e.g., 711, 713, . . . , or 719) of the sub-region (e.g., 721, 723, . . . , or 729).

At blocks 766 and 767, if it is determined that the sub-region (e.g., 721, 723, . . . , or 729) has not yet been cached in the physical memory region (588), the computing device communicates with the remote device to cache the sub-region.

At block 769, the computing device performs memory access using the physical memory address (257), once the sub-region (e.g., 721, 723, . . . , or 729) has been cached in the physical memory region (588).

For example, if it is determined (766) that the sub-region (e.g., 721, 723, . . . , or 729) has not yet been cached in the physical memory region (588), the computing device can generate a memory fault. In response to the memory fault, the operating system of the computing device is executed to communicate with the remote device to cache the corresponding sub-region in the physical memory region (588).

Alternatively, a memory management unit (e.g., 216) of the computing device is configured to communicate with the remote device to cache the corresponding sub-region in the physical memory region, if it is determined (766) that the sub-region (e.g., 721, 723, . . . , or 729) has not yet been cached in the physical memory region (588). The memory management unit (e.g., 216) can perform the caching operating without the processor(s) (e.g., 215) of the computing device executing the operating system (e.g., 213) of the computing device.

For example, a compiler can inject instructions in an application when compiling the program of the application. The instructions injected at locations in the application such that just before the application to access memory using virtual memory addresses allocated from the operating system (213), the instructions are executed to check local cache availability of virtual memory addresses. Thus, the instructions can be configured to request the operating system of the computing device to cache a corresponding sub-region just before accessing a virtual address in the sub-region.

For example, the compiler can be configured to determine the locations in the program of the application where access to dynamically allocated memory is made. The memory access requests in the program can be replaced with a modified version of memory access requests that check the local cache availability statuses before making the corresponding memory access requests.

The computing device can be configured to allocate memory to store the memory status map (701), in response to the allocating of the virtual memory address region (581) to address the portion (586) of the memory loaned by the remote device to the computing device. For example, when the application (212) running in the computing device requests the operating system (213) for an amount of memory, the operating system (213) can allocate a corresponding amount of the memory for the associated memory status map. The location of the memory status map (701) can be specified in the portion of the virtual to physical memory map (253) for the virtual address region (581).

For example, at least a portion of the virtual to physical memory map (701) can be loaded into a translation lookaside buffer (251) of a memory management unit (216) of the computing device. When the portion of the virtual to physical memory map (701) is in the translation lookaside buffer (251), the memory management unit (216) has sufficient resources to convert the virtual memory address (255) into a physical memory address (257). Prior to using the physical memory address (257), the memory management unit (216), the operating system (215), or the instructions/routine inserted by a compiler, checks the memory status map (701) to ensure that the virtual memory address (255) can be accessed via the physical memory address (257).

Optionally, the memory management unit (216) can cache at least a portion of the memory status map (701) when the virtual to physical memory map (253) loaded in the translation lookaside buffer (251) includes the portion for converting the addresses in the virtual address region (581) into the addresses in the physical address region (587).

Optionally, the computing device and/or the remote device can track a memory usage history of the virtual memory address region (581) based on changes made to the memory status map (701). The computing device and/or the remote device can predict a usage of a sub-region of the virtual memory address region (581). If the sub-region having the predicted usage lacks local cache availability in the physical memory region (588), the computing device and the remote device can communicate with each other to cache the sub-region in the physical memory region (588). For example, the prediction can be made based on an ANN trained using the memory usage history.

In general, each of the devices or servers discussed above (e.g., 101, 103, 105, 107, 201, 203, 621, 623) can be implemented as one or more data processing systems.

A typical data processing system may include an inter-connect (e.g., bus and system core logic), which interconnects a microprocessor(s) and memory. The microprocessor may also have on-die cache hierarchy.

The inter-connect interconnects the microprocessor(s) and the memory together and also interconnects them to input/output (I/O) device(s) via I/O controller(s). I/O devices may include a display device and/or peripheral devices, such as mice, keyboards, modems, network interfaces, printers, scanners, video cameras and other devices known in the art. In one embodiment, when the data processing system is a server system, some of the I/O devices, such as printers, scanners, mice, and/or keyboards, are optional.

The inter-connect can include one or more buses connected to one another through various bridges, controllers and/or adapters. In one embodiment the I/O controllers include a USB (Universal Serial Bus) adapter for controlling USB peripherals, and/or an IEEE-1394 bus adapter for controlling IEEE-1394 peripherals.

The memory may include one or more of: ROM (Read Only Memory), volatile RAM (Random Access Memory), and non-volatile memory, such as hard drive, flash memory, etc.

Volatile RAM is typically implemented as dynamic RAM (DRAM) which requires power continually in order to refresh or maintain the data in the memory. Non-volatile memory is typically a magnetic hard drive, a magnetic optical drive, an optical drive (e.g., a DVD RAM), FLASH memory, 3D cross point or other type of memory system which maintains data even after power is removed from the system. The non-volatile memory may also be a random access memory.

The non-volatile memory can be a local device coupled directly to the rest of the components in the data processing system. A non-volatile memory that is remote from the system, such as a network storage device coupled to the data processing system through a network interface such as a modem or Ethernet interface, can also be used.

In the present disclosure, some functions and operations are described as being performed by or caused by software code to simplify description. However, such expressions are also used to specify that the functions can result from execution of the code/instructions by a processor, such as a microprocessor or any IP block of SoS (System-on-a-Chip).

Alternatively, or in combination, the functions and operations as described herein can be implemented using special purpose circuitry, with or without software instructions, such as using Application-Specific Integrated Circuit (ASIC) or Field-Programmable Gate Array (FPGA). Embodiments can be implemented using hardwired circuitry without software instructions, or in combination with software instructions. Thus, the techniques are limited neither to any specific combination of hardware circuitry and software, nor to any particular source for the instructions executed by the data processing system.

While one embodiment can be implemented in fully functioning computers and computer systems, various embodiments are capable of being distributed as a computing product in a variety of forms and are capable of being applied regardless of the particular type of machine or computer-readable media used to actually effect the distribution.

At least some aspects disclosed can be embodied, at least in part, in software. That is, the techniques may be carried out in a computer system or other data processing system in response to its processor, such as a microprocessor, executing sequences of instructions contained in a memory, such as ROM, volatile RAM, non-volatile memory, cache or a remote storage device.

Routines executed to implement the embodiments may be implemented as part of an operating system or a specific application, component, program, object, module or sequence of instructions referred to as “computer programs.” The computer programs typically include one or more instructions set at various times in various memory and storage devices in a computer, and that, when read and executed by one or more processors in a computer, cause the computer to perform operations necessary to execute elements involving the various aspects.

A machine readable medium can be used to store software and data which when executed by a data processing system causes the system to perform various methods. The executable software and data may be stored in various places including for example ROM, volatile RAM, non-volatile memory and/or cache. Portions of this software and/or data may be stored in any one of these storage devices. Further, the data and instructions can be obtained from centralized servers or peer to peer networks. Different portions of the data and instructions can be obtained from different centralized servers and/or peer to peer networks at different times and in different communication sessions or in a same communication session. The data and instructions can be obtained in entirety prior to the execution of the applications. Alternatively, portions of the data and instructions can be obtained dynamically, just in time, when needed for execution. Thus, it is not required that the data and instructions be on a machine readable medium in entirety at a particular instance of time.

Examples of computer-readable media include but are not limited to non-transitory, recordable and non-recordable type media such as volatile and non-volatile memory devices, read only memory (ROM), random access memory (RAM), flash memory devices, floppy and other removable disks, magnetic disk storage media, optical storage media (e.g., Compact Disk Read-Only Memory (CD ROM), Digital Versatile Disks (DVDs), etc.), among others. The computer-readable media may store the instructions.

The instructions may also be embodied in digital and analog communication links for electrical, optical, acoustical or other forms of propagated signals, such as carrier waves, infrared signals, digital signals, etc. However, propagated signals, such as carrier waves, infrared signals, digital signals, etc. are not tangible machine readable medium and are not configured to store instructions.

In general, a machine readable medium includes any mechanism that provides (i.e., stores and/or transmits) information in a form accessible by a machine (e.g., a computer, network device, personal digital assistant, manufacturing tool, any device with a set of one or more processors, etc.).

In various embodiments, hardwired circuitry may be used in combination with software instructions to implement the techniques. Thus, the techniques are neither limited to any specific combination of hardware circuitry and software nor to any particular source for the instructions executed by the data processing system.

The above description and drawings are illustrative and are not to be construed as limiting. Numerous specific details are described to provide a thorough understanding. However, in certain instances, well known or conventional details are not described in order to avoid obscuring the description. References to one or an embodiment in the present disclosure are not necessarily references to the same embodiment; and, such references mean at least one.

In the foregoing specification, the disclosure has been described with reference to specific exemplary embodiments thereof. It will be evident that various modifications may be made thereto without departing from the broader spirit and scope as set forth in the following claims. The specification and drawings are, accordingly, to be regarded in an illustrative sense rather than a restrictive sense. 

What is claimed is:
 1. A mobile device, comprising: a communication device configured to communicate over a cellular communications network to access a computing system; at least one microprocessor; and a first memory coupled within the mobile device to the at least one microprocessor; wherein the mobile device is configured to: transmit, via the communication device, a request to borrow, from the computing system, an amount of a second memory of the computing system; generate a memory map to map virtual memory addresses, used in instruction executions in the at least one microprocessor, to physical memories, including the first memory coupled locally to the at least one microprocessor and the amount of the second memory connected to the at least one microprocessor via the communication device; and adjust the memory map, in response to access to a virtual memory address mapped to the amount of the second memory, to remap a unit of virtual memory addresses from being hosted in the amount of the second memory to being hosted in the first memory.
 2. The mobile device of claim 1, further configured to use a first region in the first memory to cache data stored in a second region in the amount of second memory borrowed from the computing system.
 3. The mobile device of claim 2, further configured to store a memory status map representative of, in the first memory, cache availability statuses of regions of virtual memory addresses.
 4. The mobile device of claim 3, further configured to, in response to a first virtual memory address being accessed by the at least one microprocessor: determine, based on the memory status map, that a third region of virtual memory addresses containing the first virtual memory address is mapped to the amount of the second memory on the computing system but lacks cache availability in the first memory; communicate, using the communication device, with the computing system to retrieve, from the amount of the second memory of the computing system, first data in the third region of virtual memory addresses; write the first data in the first region in the first memory; and update the memory status map to indicate the first data of the third region of virtual memory addresses having cache availability in the first memory.
 5. The mobile device of claim 4, further configured to, in response to a second virtual memory address being accessed by the at least one microprocessor: determine, based on the memory status map, that the third region of virtual memory addresses containing the second virtual memory address is mapped to the amount of the second memory on the computing system and has cache availability in the first memory; and map the second virtual memory address to the first region in the first memory.
 6. The mobile device of claim 4, further configured to: generate a memory fault in response to a determination that the third region of virtual memory addresses containing the first virtual memory address is mapped to the amount of the second memory of the computing system but lacks cache availability in the first memory.
 7. The mobile device of claim 6, wherein the memory fault is configured to cause the mobile device to retrieve the first data from the computing system.
 8. The mobile device of claim 7, further comprising: a memory management unit configured to, responsive to the memory fault, use the communication device to retrieve the first data from the computing system and store the first data into the first region in the first memory.
 9. The mobile device of claim 6, wherein the mobile device is configured via instructions injected into an application, the instructions when executed cause the mobile device to make the determination that the third region of virtual memory addresses containing the first virtual memory address is mapped to the amount of the second memory of the computing system but lacks cache availability in the first memory.
 10. A method, comprising: communicating, by a communication device of a mobile device, over a cellular communications network to access a computing system; transmitting, via the communication device, a request to borrow, from the computing system, an amount of a second memory of the computing system; generate a memory map to map virtual memory addresses, used in instruction executions in at least one microprocessor of the mobile device, to physical memories, including a first memory coupled locally to the at least one microprocessor in the mobile device and the amount of the second memory connected to the at least one microprocessor via the communication device; and adjusting the memory map, in response to access to a virtual memory address mapped to the amount of the second memory, to remap a unit of virtual memory addresses from being hosted in the amount of the second memory to being hosted in the first memory.
 11. The method of claim 10, further comprising: caching, in a first region of the first memory, data stored in a second region in the amount of second memory borrowed from the computing system.
 12. The method of claim 11, further comprising: storing a memory status map representative of, in the first memory, cache availability statuses of regions of virtual memory addresses.
 13. The method of claim 12, further comprising, in response to a first virtual memory address being accessed by the at least one microprocessor: determining, based on the memory status map, that a third region of virtual memory addresses containing the first virtual memory address is mapped to the amount of the second memory on the computing system but lacks cache availability in the first memory; communicating, using the communication device, with the computing system to retrieve, from the amount of the second memory of the computing system, first data in the third region of virtual memory addresses; writing the first data in the first region in the first memory; and updating the memory status map to indicate the first data of the third region of virtual memory addresses having cache availability in the first memory.
 14. The method of claim 13, further comprises, in response to a second virtual memory address being accessed by the at least one microprocessor: determining, based on the memory status map, that the third region of virtual memory addresses containing the second virtual memory address is mapped to the amount of the second memory on the computing system and has cache availability in the first memory; and mapping the second virtual memory address to the first region in the first memory.
 15. The method of claim 13, further configured to: generating a memory fault in response to a determination that the third region of virtual memory addresses containing the first virtual memory address is mapped to the amount of the second memory of the computing system but lacks cache availability in the first memory.
 16. The method of claim 15, further comprising: injecting instructions into an application, the instructions when executed cause the mobile device to make the determination that the third region of virtual memory addresses containing the first virtual memory address is mapped to the amount of the second memory of the computing system but lacks cache availability in the first memory.
 17. A non-transitory computer storage medium storing instructions which, when executed in a mobile device, cause the mobile device to perform a method, comprising: communicating, by a communication device of the mobile device, over a cellular communications network to access a computing system; transmitting, via the communication device, a request to borrow, from the computing system, an amount of a second memory of the computing system; generate a memory map to map virtual memory addresses, used in instruction executions in at least one microprocessor of the mobile device, to physical memories, including a first memory coupled locally to the at least one microprocessor in the mobile device and the amount of the second memory connected to the at least one microprocessor via the communication device; and adjusting the memory map, in response to access to a virtual memory address mapped to the amount of the second memory, to remap a unit of virtual memory addresses from being hosted in the amount of the second memory to being hosted in the first memory.
 18. The non-transitory computer storage medium of claim 17, wherein the method further comprises: caching, in a first region of the first memory, data stored in a second region in the amount of second memory borrowed from the computing system; and storing a memory status map representative of, in the first memory, cache availability statuses of regions of virtual memory addresses.
 19. The non-transitory computer storage medium of claim 18, wherein the method further comprises: in response to a first virtual memory address being accessed by the at least one microprocessor: determining, based on the memory status map, that a third region of virtual memory addresses containing the first virtual memory address is mapped to the amount of the second memory on the computing system but lacks cache availability in the first memory; communicating, using the communication device, with the computing system to retrieve, from the amount of the second memory of the computing system, first data in the third region of virtual memory addresses; writing the first data in the first region in the first memory; and updating the memory status map to indicate the first data of the third region of virtual memory addresses having cache availability in the first memory; and in response to a second virtual memory address being accessed by the at least one microprocessor: determining, based on the memory status map, that the third region of virtual memory addresses containing the second virtual memory address is mapped to the amount of the second memory on the computing system and has cache availability in the first memory; and mapping the second virtual memory address to the first region in the first memory.
 20. The non-transitory computer storage medium of claim 19, wherein the method further comprises: injecting instructions into an application, the instructions when executed cause the mobile device to: make a determination that the third region of virtual memory addresses containing the first virtual memory address is mapped to the amount of the second memory of the computing system but lacks cache availability in the first memory; and generate a memory fault in response to the determination that the third region of virtual memory addresses containing the first virtual memory address is mapped to the amount of the second memory of the computing system but lacks cache availability in the first memory. 